Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68269 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68126 invoked from network); 20 Jul 2013 11:37:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2013 11:37:56 -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:33526] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 18/64-13120-2967AE15 for ; Sat, 20 Jul 2013 07:37:55 -0400 Received: from [192.168.2.20] (host-188-174-219-187.customer.m-online.net [188.174.219.187]) (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 6CD9065FB6; Sat, 20 Jul 2013 13:37:51 +0200 (CEST) To: Ryan McCue Cc: internals@lists.php.net In-Reply-To: <51EA11E2.7030807@rotorised.com> References: <1374256806.3946.101.camel@guybrush> <51EA0F30.3010609@rotorised.com> <51EA11E2.7030807@rotorised.com> Content-Type: text/plain; charset="UTF-8" Date: Sat, 20 Jul 2013 13:37:39 +0200 Message-ID: <1374320259.3946.116.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Language constructs and callability From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Sat, 2013-07-20 at 14:28 +1000, Ryan McCue wrote: > Sara Golemon wrote: > > Well, now... to be fair... You could make them functions and use the same > > parser trick the backtick operator uses. to map the non-parenthesized > > versions.... feels messy though. I'd just hate to get stuck with a hacky > > workaround like that for the long term. > > That's what I meant by the "backwards compatibility layer". Not saying > we have to deprecate the use as a construct, but why can't we enable the > use as a function (and hence, callback, etc)? It feels less cleaner from > my point of view (userland). There again is a thing we can't emulate using functions: The operator precedence when using () with echo is "special": php > echo(0) || print(1); 11 alright, that's weird isn't it? Anyways let's try to emulate using a function: php > function echo_func($foo) { php { echo $foo; php { } php > echo_func(0) || print(1); 01 damn different result, ah, echo-func returns NULL maybe when we return true? php function echo_func1($foo) { php { echo $foo; php { return true; php { } php > echo_func1(0) || print(1); 0 still not. Reason is that currently in echo(0) || print(1); the expression (0) || print(1) is evaluated first and then the result is passed to echo. Maybe one might have designed it differently but more than 15 years into the game it's hard. johannes