AW: [PHP-DEV] [RFC:generics]

From: Date: Thu, 21 Apr 2016 17:26:41 +0000
Subject: AW: [PHP-DEV] [RFC:generics]
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-92600@lists.php.net to get a copy of this message
Hi Rasmus > Hello internals, > > I'd like to introduce an RFC proposing the addition of generic types and functions: > > https://wiki.php.net/rfc/generics > > Ben Scholzen started this RFC as a quick draft with a few code samples in August last year, and > I have since then worked > with Dominic and Ben towards a more complete, detailed RFC. > > There are a few holes still, which is why it hasn't moved from Draft to Under Discussion > yet, but we feel that it's complete > enough that we can start a discussion about this feature and try to iron out the remaining > details. > > The RFC was previously "unofficially" announced on reddit - this thread generated > some good questions and may answer > some of the most immediate questions: > > > https://www.reddit.com/r/PHP/comments/3zx8qs/php_rfcgenerics_update_03_please_comment/ > > One of the most common criticisms we've heard, is that the syntax would be hard to > implement, a few have said > "impossible" - but we feel that, if generics are introduced, it's important that > the syntax and features be as familiar as > possible to developers who are experienced with other mainstream web industry languages, such > as C# and Java. > > To that end, Dominic Grostate has worked through most of the tokenizer/parser issues - save for > one very exotic edge > case, his fork demonstrates that the proposed syntax can be parsed: > > https://github.com/orolyn/php-src/commits/generics > > Note that this fork is by no means an implementation of generics - it is proof of concept as > far as being able to parse the > syntax. > > We're hoping to find someone, with more experience working on the php codebase, who is > willing to collaborate on > further implementation - and we do also have a partial test-suite, defining the big picture > expectations for most of the > proposed language features: > > > https://github.com/orolyn/php-src/tree/generics-tests/Zend/tests/generics > > We look forward to your comments, questions and (I'm sure) criticisms of this proposal! > > Thank You, > > Regards, > Rasmus Schultz > > -- > PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: > http://www.php.net/unsub.php Some questions about bounds checking: - Example A: why don't you pass T (instead of Computer) to MachineBuilder? Just for the example or is it not possible with your approach? - What about lower bounds? In you examples about type checking you write: > var_dump($hat_box instanceof Box); // => (bool) true Will you support "raw types" similar as in Java, if so why? you wrote: > TODO: decide whether or not bounded polymorphism should be supported. I am a bit confused, isn't parametric polymorphism combined with upper bounds already bounded polymorphism?

« previous php.internals (#92600) next »