Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65670 invoked from network); 10 Feb 2015 10:03:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Feb 2015 10:03:23 -0000 Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.220.48 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.220.48 mail-pa0-f48.google.com Received: from [209.85.220.48] ([209.85.220.48:34332] helo=mail-pa0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/41-47508-A67D9D45 for ; Tue, 10 Feb 2015 05:03:22 -0500 Received: by mail-pa0-f48.google.com with SMTP id eu11so18392843pac.7 for ; Tue, 10 Feb 2015 02:03:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=P8mYrF1vZmKPwbZQzbRau0dY53/whLfYFkMpwKSYF6I=; b=Kpn5G/1mXcgcwIZzqvFRdY2Z6olkYnCqbKOgJxhZQV6FQUgCGiaRyWLHnI5YFKakQk PMSiut+SPezn+0uH23acAADXYndp8qkkfLWqkYEy8w52PsxBvWG6W2BSqX8YTYt/hiOB +5+5Hbp/v9TF1DhWgkQRqmhkqhCVxnVglKU0ZZ9ssOs0c4QwBwHgVx1J0+hXHM9ZsZB6 W6TrhXii6fxY8F8BZSSKRARILeHUTnumFFEV5el8BdgDHCYO+tD/xEsKVlOsmHQxrvrK INzw+vrSTvFO9hGgvDlZYtxf1btQpTi2fzZuww6qr421GgoOx11FFTSYaSHK6QjMvFEm ic9A== X-Gm-Message-State: ALoCoQnPONDU2JGeY6s1np0Iss573gt6iKqhse19hzuqkYga7zhZQp8FzcMw7AicZWqbaALzZg30 MIME-Version: 1.0 X-Received: by 10.68.109.195 with SMTP id hu3mr6467993pbb.84.1423562599430; Tue, 10 Feb 2015 02:03:19 -0800 (PST) Received: by 10.70.49.100 with HTTP; Tue, 10 Feb 2015 02:03:19 -0800 (PST) X-Originating-IP: [109.145.22.92] In-Reply-To: References: <54D7ED22.3080001@gmail.com> Date: Tue, 10 Feb 2015 10:03:19 +0000 Message-ID: To: Dmitry Stogov Cc: Patrick Schaaf , internals , Yasuo Ohgaki Content-Type: multipart/alternative; boundary=047d7b86f3560e16bd050eb8ff61 Subject: Re: [PHP-DEV] Design by Contract From: pthreads@pthreads.org (Joe Watkins) --047d7b86f3560e16bd050eb8ff61 Content-Type: text/plain; charset=UTF-8 The solution D uses is allowing the programmer to declare the name of the return value like, we could do something like: public function method() return ($result) ($result <= 10 && $result >= 0) { return 5; } If you didn't need the result, were working with a scope variable, or maybe even a param taken by reference: public function method() return ($expr) { /* ... */ } I'm not keen on __CONSTANTS__, it's long, and if you have the choice to name the variable you have the option of making the expression ... expressive ... Cheers Joe On Tue, Feb 10, 2015 at 9:48 AM, Dmitry Stogov wrote: > I think __RETURN__ is better than $ret. > > Dmitry. > > On Tue, Feb 10, 2015 at 12:43 PM, Patrick Schaaf wrote: > >> Am 10.02.2015 09:29 schrieb "Dmitry Stogov" : >> > >> > I cnahged $> into $ret, because $> just won't work. Some better >> solution is welcome. >> >> Also think $> would be awful. Don't like $ret either. What about a magic >> constant __RETURN__ or __RESULT__? This would stand out very well when >> glancing at the expression, would fit in with naming of other magic >> constants, and might even be made to work in finally blocks, where the same >> need for access to the returned value exists. >> >> best regards >> Patrick >> > > --047d7b86f3560e16bd050eb8ff61--