Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68518 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42405 invoked from network); 14 Aug 2013 14:23:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2013 14:23:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 157.55.1.158 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 157.55.1.158 dub0-omc2-s19.dub0.hotmail.com Windows 2000 SP4, XP SP1 Received: from [157.55.1.158] ([157.55.1.158:7094] helo=dub0-omc2-s19.dub0.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/96-06453-2F29B025 for ; Wed, 14 Aug 2013 10:23:47 -0400 Received: from DUB405-EAS128 ([157.55.1.137]) by dub0-omc2-s19.dub0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 14 Aug 2013 07:23:44 -0700 X-TMN: [LsRfqIudHwBoK8r7zX4zAe76HtKL0NCX] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable References: MIME-Version: 1.0 (1.0) In-Reply-To: Date: Wed, 14 Aug 2013 12:23:41 -0200 To: Anthony Ferrara CC: "internals@lists.php.net" X-OriginalArrivalTime: 14 Aug 2013 14:23:44.0159 (UTC) FILETIME=[E1B8DAF0:01CE98F9] Subject: Re: [PHP-DEV] [RFC] Constant Scalar Expressions From: bobwei9@hotmail.com (Bob Weinand) Am 13.08.2013 um 14:13 schrieb "Anthony Ferrara" : > Hello all, >=20 > I'd like to propose a new RFC for 5.NEXT: >=20 > https://wiki.php.net/rfc/const_scalar_expressions >=20 > This allows for defining constant expressions which are resolved at compil= e > time. >=20 > for example: >=20 > const FOO =3D 1 + 1; > static $bar =3D 1 << 2; > function foo($a =3D 1 | 2) {} > class foo { > public $bar =3D 1 << 2; > } >=20 > Thoughts? >=20 > Anthony It really would be nice to use constants in these constant expressions. I think this would be particulary useful when using bitwise operators. Examp= le: const FLAG_A =3D 1; const FLAG_B =3D 2; const FLAG_C =3D 4; With this proposal we would write: function func ($arg =3D 1 | 2 | 4) # we now need to lookup first which const= ants have values 1, 2 and 4 But it would be much more understandable if we were able to write: function func ($arg =3D FLAG_A | FLAG_B | FLAG_C) Bob Weinand=