Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69897 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32423 invoked from network); 27 Oct 2013 14:28:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Oct 2013 14:28:00 -0000 Authentication-Results: pb1.pair.com header.from=cpriest@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=cpriest@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 66.111.4.28 as permitted sender) X-PHP-List-Original-Sender: cpriest@php.net X-Host-Fingerprint: 66.111.4.28 out4-smtp.messagingengine.com Received: from [66.111.4.28] ([66.111.4.28:50235] helo=out4-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/AB-45431-EE22D625 for ; Sun, 27 Oct 2013 09:27:59 -0500 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id A91D4207CE; Sun, 27 Oct 2013 10:27:56 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Sun, 27 Oct 2013 10:27:56 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=ONJSDKAeifN4L4TOB+fjKd nSMwQ=; b=o3SFkCQxcKjmUNoWqrH3sSKhXPrebdeQkvXVwK7pYF5QuAPVMZD+A0 N7asI1BTi4rpN7XsgREMx2cI9rEDVDAddCY8WOSN8O/G2Rg/WeVz2TjHBvByinkt vr0GYoxwbJdHOkZzfCKz6bhuAZOSwnu8bOEKpHRR+UbbnvEN2+omc= X-Sasl-enc: PhQBCoCU2+uE3DMkxAIeWSONQ7ezDiWFddTGOM7TorX6 1382884076 Received: from mail.zerocue.com (unknown [67.200.53.250]) by mail.messagingengine.com (Postfix) with ESMTPA id 6E07E680169; Sun, 27 Oct 2013 10:27:56 -0400 (EDT) Received: from [172.17.0.84] (65-111-100-3.static.grandenetworks.net [65.111.100.3]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.zerocue.com (Postfix) with ESMTPSA id D2D74120205; Sun, 27 Oct 2013 09:27:55 -0500 (CDT) Message-ID: <526D22D8.4050104@php.net> Date: Sun, 27 Oct 2013 09:27:36 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Stas Malyshev CC: "internals@lists.php.net" References: <520B4772.8090701@sugarcrm.com> <520BBA89.1090208@sugarcrm.com> <520D6758.4050500@sugarcrm.com> <1376611023.14536.245.camel@guybrush> <520D9F94.9010803@sugarcrm.com> In-Reply-To: <520D9F94.9010803@sugarcrm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Constant Scalar Expressions From: cpriest@php.net (Clint Priest) On 8/15/2013 10:42 PM, Stas Malyshev wrote: > Hi! > >> note that we have this functionality already: >> >> $ php -r 'class A { const C = FOO; } define("FOO", 23); echo A::C;' >> 23 >> >> The first fetch will resolve that. > This is true, but what happens is that "FOO" is stored and then resolved > on fetch with direct lookup. Now, if C = M_PI/2, what would we store? We > could theoretically store string "M_PI/2" and somehow "evaluate" it, or > we could even translate: > > class A { const C = M_PI/2; } > > to: > > class A { const C = __definition_of_A_C; } > > function __define_A_C() { define(__definition_of_A_C, M_PI/2); } > > and when we encounter __definition_of_A_C for the first time we run > __define_A_C() and take the value of __definition_of_A_C - but I imaging > that would seriously complicate the code, especially if we think about > how to handle exceptional situations there... Stas, is there any currently existing standard "Just In Time" construct in zend? Something like a Promise? http://en.wikipedia.org/wiki/Futures_and_promises If there isn't, would it make sense to add this type of feature into the core so that these types of needs could be handled with a Promise? The late binding aspect is similar in concept to a Promise I believe... -Clint