Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92493 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32411 invoked from network); 19 Apr 2016 20:30:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Apr 2016 20:30:44 -0000 Received: from [127.0.0.1] ([127.0.0.1:3852]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id DA/18-22821-37596175 for ; Tue, 19 Apr 2016 16:30:43 -0400 Authentication-Results: pb1.pair.com smtp.mail=mathieu@texthtml.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mathieu@texthtml.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain texthtml.net designates 62.210.206.189 as permitted sender) X-PHP-List-Original-Sender: mathieu@texthtml.net X-Host-Fingerprint: 62.210.206.189 texthtml.net Received: from [62.210.206.189] ([62.210.206.189:60094] helo=texthtml.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/17-22821-A3296175 for ; Tue, 19 Apr 2016 16:17:00 -0400 Received: by texthtml.net (Postfix, from userid 65534) id B061B23C; Tue, 19 Apr 2016 20:16:54 +0000 (UTC) Received: from [192.168.1.70] (stunnel_mail_1.mail_default [172.27.0.4]) (Authenticated sender: mathieu@texthtml.net) by texthtml.net (Postfix) with ESMTPA id 8D78C23A; Tue, 19 Apr 2016 20:16:51 +0000 (UTC) To: Dominic Grostate , Josh Di Fabio References: Cc: PHP internals , Ben Scholzen 'DASPRiD' , Rasmus Schultz Message-ID: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> Date: Tue, 19 Apr 2016 22:16:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Thunderbird/47.0a2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------0BB7B9343AF87811E47518D8" Subject: Re: [PHP-DEV] [RFC:generics] From: mathieu@texthtml.net (Mathieu Rochette) --------------0BB7B9343AF87811E47518D8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 04/19/2016 06:28 PM, Dominic Grostate wrote: > We would really like some feedback on this. We know it is a massive > feature, but we have put in quite a lot of research in both the language > implications and implementation challenges. Please ask any questions you > have. thank you all for your work on this. That's a very interesting feature ! I guess it is possible but I have not seen it explicitly, can I do this: class StringKeyEntry extends Entry {} In "Traits" there is mistake; class Box { use Box; } should be class Box { use Container; } about the upper bounds, have you consider another way of describing the constraints, eg: class Box where T is Boxable { // ... } this would allow multiple constraints, eg: class Collection where T is Traversable, T is Countable { // ... } and, maybe, union type class Collection where T is one of (\first\lib\Collection, \seconf\lib\Arrayable) { // ... } can generic types be nested ? eg: class Stuff> { // ... } considering the related enhancements, I guess this rfc is already big and both are useful enough to be proposed on their own. regards, > > Thanks. > On 18 Apr 2016 11:24 a.m., "Josh Di Fabio" wrote: > >> On Mon, Apr 18, 2016 at 10:47 AM, Josh Di Fabio >> wrote: >>> On Mon, Apr 18, 2016 at 6:20 AM, Rasmus Schultz >> wrote: >>>> 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 >>>> >>> Nice work. >>> >>> I think you there's a typo in one of your examples: >>> >>> write(new Entry(1, 2)); // throws a TypeError >>> >>> Presumably this should be or something similar? >> Ignore me, I didn't read the example properly. >> -- Mathieu Rochette --------------0BB7B9343AF87811E47518D8--