Hi Ben and Rasmus,

On Thu, Jan 7, 2016 at 6:24 PM, Ben Scholzen 'DASPRiD' <m...@dasprids.de>
wrote:

> By the way, Rasmus updated the RFC quite a bit, you guys may want to take
> a look at it again.
>
>
I just have a couple questions about the rfc, but overall I think its great
and I really hope it makes it into PHP!

Note that the choice of the keyword is to indicate upper bounds is based on
> the rejection of perhaps more obvious alternatives - repurposing the
> extends or implements keywords would be misleading, since they would work
> precisely the same way; worse, permitting both keywords would render
> consumer code invalid if an upper bound type provided by a library is
> refactored between class and interface. Repurposing instanceof would also
> be misleading, since the upper bound is checking the type-hint, not an
> instance.
>

Why not use "as" which is already the keyword used to define aliases?
Probably of the form class foo<DateTimeInterface as DateType> I think this
feels more natural, as its how we do aliasing with a use statement. Also,
this way it follows the same style as other aliases "RealName as Alias".
I'm not saying is doesn't work, but I wonder if you'd considered as and if
so, why you decided against it.

When autoloading is triggered e.g. by a new statement with a generic type,
> autoloading is triggered as normal, with only the class-name (without type
> parameters) being supplied.
>


In other words, a statement like new Map<int,string>() will trigger
> auto-loading of class Map.


What order are things autoloaded (or does it even matter)? For example,
given the following - does it matter what order things are autoloaded? It
feels like it would but I'm not sure what would get resolved first:

class Gen<IDType, DisplayType, StorageType> {}
class ListGenerator implements HtmlGenerator {}
class FtpWriter extends FileIO {}
new Gen<int, HtmlGenerator, FileIO>(123, new ListGenerator(), new
FtpWriter());

Again, I'm not sure if it matters but would there be any problems (and this
goes to the whole list, since your RFC says you're not a C coder) with the
order of autoloading with relation to resolving validity of types?

In your second example in the Trait section you have:

> class Box<T>
> {
>     use Box<T>;
> }

I think you meant to say "use Container<T>;" as that is the name of your
trait.

Again, really awesome RFC and I hope it can be implemented and accepted!

~Ryan

Reply via email to