> -----Original Message-----
> From: Dmitry Stogov [mailto:dmi...@zend.com]
> Sent: Thursday, March 31, 2016 11:59 AM
> To: Joe Watkins <pthre...@pthreads.org>; Björn Larsson
> <bjorn.x.lars...@telia.com>
> Cc: Phil Sturgeon <pjsturg...@gmail.com>; Krakjo <krak...@php.net>; PHP
> internals <internals@lists.php.net>
> Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties
> 
> 
> 
> On 03/31/2016 11:34 AM, Joe Watkins wrote:
> > Morning,
> >
> > > Given that public is implied for all properties above there is a
> > > value in having the same rule for type.
> >
> > public $bar, int $foo;
> >
> > What does this mean?
> >
> > If it's not an error, what does this mean ?
> 
> This should be a error. I also think, that "public" might be omitted, and it
> should be possible to write "int $bar, $foo".
> 
> >
> > public $bar, int $foo, $qux;
> >
> > If it's an error, why is it an error ?
> >
> > Both of these examples are just as ambiguous as
> >
> > public int $foo, $bar, $qux;
> 
> You say - C, C++, Java, HHVM, etc - all made worse decision? OK...

I want to point out that there's nothing ambiguous about:
public Person $foo, $bar, $qux;

Much like access modifiers effect the entire declaration statement, and much 
like type modifiers effect the entire statement in other languages (C, C++, 
Java, etc.) - unless we explicitly decide to introduce a new kind of syntax 
into PHP, it's clear that Person applies to the whole line.  There's really no 
reason to introduce a new kind of modifier that affects only a part of the 
statement.

Public $foo, Person $bar, $qux;

Should not be allowed (syntax error).  Modifiers must be at the beginning of 
the statement, or not be there at all.

FWIW, like Johannes I'm not fond of the fact PHP is becoming a typed language;  
But if it does pass, at least it should be consistent with the rest of the 
language syntax.

Zeev 

Reply via email to