Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70062 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40921 invoked from network); 7 Nov 2013 16:02:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2013 16:02:30 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.116.29 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.116.29 blu0-omc1-s18.blu0.hotmail.com Windows 2000 SP4, XP SP1 Received: from [65.55.116.29] ([65.55.116.29:39672] helo=blu0-omc1-s18.blu0.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/91-31766-599BB725 for ; Thu, 07 Nov 2013 11:02:30 -0500 Received: from BLU0-SMTP9 ([65.55.116.7]) by blu0-omc1-s18.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 7 Nov 2013 08:02:27 -0800 X-TMN: [MI4Lpcayt0uOeVxMMx2dJHoX88PksmIo] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Received: from bobweinandsimac.fritz.box ([83.99.63.185]) by BLU0-SMTP9.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 7 Nov 2013 08:02:24 -0800 Content-Type: text/plain; charset="windows-1252" MIME-Version: 1.0 (Mac OS X Mail 7.0 \(1816\)) In-Reply-To: Date: Thu, 7 Nov 2013 17:02:21 +0100 CC: internals , Dmitry Stogov Content-Transfer-Encoding: quoted-printable References: To: Derick Rethans X-Mailer: Apple Mail (2.1816) X-OriginalArrivalTime: 07 Nov 2013 16:02:25.0092 (UTC) FILETIME=[BFFC4840:01CEDBD2] Subject: Re: [PHP-DEV] [RFC] Constant Scalar Expressions (with constants) From: bobwei9@hotmail.com (Bob Weinand) Am 7.11.2013 um 14:34 schrieb Derick Rethans : > On Thu, 7 Nov 2013, Bob Weinand wrote: >> Hi! >>=20 >> As you all know, Anthony Ferrara had withdrawn his RFC a few months = ago, which was without support for constants in these expressions: >>=20 >> const foo =3D 10; >> const bar =3D 10 * foo; >>=20 >> The use of a constant in a declaration of a constant was not yet = possible with his patch. >>=20 >> That's what I changed. >>=20 >> Enjoy reading the RFC at: >>=20 >> https://wiki.php.net/rfc/const_scalar_exprs >=20 > = https://github.com/bwoebi/php-src/compare/const_scalar_exprs#diff-4d0b9309= 4aafe8cf519b4f0a3322f471L590 >=20 > -#define IS_CALLABLE 10 > +#define IS_CONSTANT_AST 10 > +#define IS_CALLABLE 11 >=20 > Can I please suggest that you do not change existing constant values?=20= > You're using a macro to check for the constant type anyway, so you can=20= > do the complex checking for constant types in there. Just comparing twice (> and <) should be faster than comparing three = times (three times an =3D=3D). Dmitry had suggested this to me. And I don't see the big disadvantage = here as IS_CALLABLE is anyway just used for the typehint. Nothing there = which relies on the fact that IS_CALLABLE equals to 10. > I'm also of the opinion that just " This can allow for writing far=20 > easier to understand code, by allowing for far more expressive code." = is=20 > by far not enough of a justification for a syntax addition. Please=20 > please try to be convincing by having good arguments, presenting=20 > alternatives and cons.=20 Well, that's _the_ justification. I can also list other justifications, = but that'd be just other ways to express the same, so I just kept it = simple. Alternatives=85 don't really exist. (at least not in function signatures = for example) And cons? Can't think of any problem with it. Bob > cheers, > Derick >=20 > --=20 > http://derickrethans.nl | http://xdebug.org > Like Xdebug? Consider a donation: http://xdebug.org/donate.php > twitter: @derickr and @xdebug > Posted with an email client that doesn't mangle email: alpine