Re: [RFC] Return Type Declarations pre-vote follow-up

From: Date: Fri, 09 May 2014 21:27:45 +0000
Subject: Re: [RFC] Return Type Declarations pre-vote follow-up
References: 1 2  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Minor issues first:

First minor issue: you have a return type "self". This is an LSB type,
> effectively the type of "new static". Levi, I remember discussing this with
> you in IRC, but not the result of that discussion. What is the reason for
> "self"? The Hack type system calls it "this", which I admit is a little
> confusing since it is the type of more things than just the literal
> variable "$this" ("new static" for example is also of type
> "this"). But the
> type "static" is much more consistent with the existing LSB language, i.e.,
> "new static". So is there any reason to call it "self" over
> "static" or
> "this"?
>

The type 'self' is not late bound, unlike 'static' and exists in the
language elsewhere; I am not introducing a new keyword 'self' in this RFC.


> Second minor issue: your reflection implementation is slightly different
> from HHVM's. I'm told we call the method "getReturnTypeText", which returns
> the hint text, or false if none exists. I don't know how strongly we feel
> about this, but at the very least, I wanted to make sure you were aware
> that you were definitely diverging from the existing implementation here,
> and that it was done intentionally. (Also, I don't think you have any test
> coverage of this feature?)


All we did was copy the existing structure in Parameter type hints; this
was done for consistency. Is there any particular reason Hack/HHVM chose to
do something entirely different for return types in regards to reflection?
I don't particularly like the way type information is handled in Reflection
anyway.


Thread (15 messages)

« previous php.internals (#74109) next »