Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68519 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45427 invoked from network); 14 Aug 2013 14:48:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2013 14:48:34 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 config.schlueters.de Received: from [217.114.211.66] ([217.114.211.66:64999] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/07-06453-1C89B025 for ; Wed, 14 Aug 2013 10:48:34 -0400 Received: from [192.168.2.20] (unknown [188.174.192.120]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id D3B6B6C764; Wed, 14 Aug 2013 16:48:30 +0200 (CEST) To: Derick Rethans Cc: Patrick Schaaf , internals , Anthony Ferrara In-Reply-To: References: <4ED7146272E04A47B986ED49E771E347BB514EEE88@Ikarus.ameusgmbh.intern> Content-Type: text/plain; charset="UTF-8" Date: Wed, 14 Aug 2013 16:48:09 +0200 Message-ID: <1376491689.14536.162.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: RE: [PHP-DEV] [RFC] Constant Scalar Expressions From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Wed, 2013-08-14 at 12:03 +0100, Derick Rethans wrote: > On Wed, 14 Aug 2013, Patrick Schaaf wrote: > > > Would this allow using constants, too? Class constants? > > > > const FOO = 1; > > const BAR = self::FOO + 1; > > const BAZ = self::FOO + 2; > > const BARF = GLOBAL_BARF; > > const IMPORT = otherclass::IMPORT; // with autoloading? > > > > In my opinion these would start to make the feature useful. > > Those are not constants, but expressions which can't be run during > compile time. We already support constants where we calculate the value at runtime via ZEND_DECLARE_CONST opcode. i.e. class A { const C1 = 1; const C2 = A::C1; } is valid. If we allow scalar arithmetic we should extend this, too to be consistent in the language. johannes