What about PDO's fetch-mode PDO::FETCH_CLASS? Apparently, it first fills in
properties and then calls the constructor. Seems unlikely that the new
behavior for uninitialized properties will cause a problem here, but
sometimes weird things happen. And this is another thing to check.
I also fully support Johannes Schlüter with the reference thing. Binding by
reference to a query, passing by reference to any sort of function might
happen here and there, and the developer will have to find workarounds in a
place which otherwise would be straighforward.

Having said that, I +1 the idea of typed properties (well, my internals
karma does not give much weight to this anyway ;-) ).

On Thu, Mar 17, 2016 at 9:11 AM Benjamin Eberlei <kont...@beberlei.de>
wrote:

> On Wed, Mar 16, 2016 at 5:36 PM, Phil Sturgeon <pjsturg...@gmail.com>
> wrote:
>
> > Hello everyone,
> >
> > I have completed the draft for an RFC, to add Typed Properties. The
> > patch has been written by the one and only Joe Watkins.
> >
> > https://wiki.php.net/rfc/typed-properties
> >
> > I would really appreciate constructive feedback on this RFC, with a
> > few areas especially:
> >
> > 1. How scared are we that integers can be expanded to floats on runtime?
>
>
> > 2. This whole temporary nullability situation, where unset properties
> > will error on attempted usage if not set. Should they instead error
> > after the constructor has been called if they are still not holding a
> > value?
> >
> > 3. Weak vs Strict. Right now this is entirely strict, with no
> > declare() to change mode. Reasons for this vary, from various sources,
> > but include "Not sure how to implement it" and "Well people should not
> > be using properties as part of their public API".
> >
> > Help on 3 would be appreciated.
> >
> > Also let's please avoid "PHP IS TURNING INTO JAVA" and the other
> > rather common rhetoric. Strict Type Hinting might have been seen as a
> > battleground for fans of strict and fans of weak to fight through a
> > keyboard, but this RFC will not be the repeat.
> >
> > We'll have a nice, orderly, constructive conversation about this RFC,
> > and improve the patch as you all provide feedback.
> >
> > Let me know what you think folks!
> >
>
> Thanks for the RFC. I love it.
>
> Some points:
>
> 1. You should really try not to open any can of worms with regard to other
> already defined parts of the language:
>
> - Assume type juggling is a given, use that exact same rules
> - Assume strict/weak is a given, don't try to change this.
> - Document how public int $var; works with regard to default type,
> explicitly define it outside the scope of nullable types and delegate
> decision forward to a potential RFC in that area.
>
> Regarding your bullets then:
>
> 1. This point is outside the scope of this RFC, it might be relevant when
> we discuss changing type juggling to be more consistent.
> 2.  This is propably the critical point of this RFC, I think given how
> public function foo(int $i) forces type juggling, typed properties should
> force juggling to. This must be after the constructor, because public
> stdClass $foo; would otherwise never work.
> 3. Weak vs strict: Outside of this RFC, assume that it is strict when
> declared, otherwise weak for consistency with the status quo.
>
>
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
-- 
Best regards,
Victor Bolshov

Reply via email to