On Mon, Apr 16, 2012 at 9:39 PM, Rick WIdmer <vch...@developersdesk.com> wrote:
> On 4/16/2012 1:02 PM, Kris Craig wrote:
>>
>> On Mon, Apr 16, 2012 at 10:31 AM, Rick
>> WIdmer<vch...@developersdesk.com>wrote:
>>>
>>>
>>> More important include doesn't currently allow multiple parms:
>>>
>>>   include "foo.bar", 'baz';
>>>
>>> Parse error: syntax error, unexpected ',' in bla.php on line xx
>> Regarding include/require, I agree that any BC break would be extremely
>> minimal.  In the 10+ years I've been developing PHP, I don't think I've
>> ever once seen somebody include multiple scripts on a single line (I
>> wasn't even aware that such a thing was allowed).
> See above.  It is not allowed now.

I think there is a misunderstanding here. Inclusions with two
arguments are currently not allowed, yes. The point is that adding
such a second argument would make the grammar ambiguous.

E.g, consider this:

func(include 'foo', $someThing);

Currently this is interpreted as the return value of 'foo' and the
variable $someThing being passed to func.

If you add a second argument it's unclear what this does. Is this a
two-argument include? I.e. should it be interpreted as

func((include 'foo', $someThing));

Or is this a one-argument include and should be interpreted as

func((include 'foo'), $someThing);

In my eyes such an ambiguity renders any proposal to add another
argument to include completely unacceptable.

The only option is to add a dedicated syntax for it like

include 'foo' as $flags;

Nikita

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to