Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63775 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5696 invoked from network); 7 Nov 2012 14:00:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2012 14:00:50 -0000 Authentication-Results: pb1.pair.com header.from=lars@strojny.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lars@strojny.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain strojny.net from 46.4.40.248 cause and error) X-PHP-List-Original-Sender: lars@strojny.net X-Host-Fingerprint: 46.4.40.248 milch.schokokeks.org Received: from [46.4.40.248] ([46.4.40.248:42981] helo=milch.schokokeks.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 58/44-57873-D896A905 for ; Wed, 07 Nov 2012 09:00:46 -0500 Received: from [192.168.1.113] (p5099f5c8.dip0.t-ipconnect.de [::ffff:80.153.245.200]) (AUTH: PLAIN lars@schokokeks.org, TLS: TLSv1/SSLv3,128bits,AES128-SHA) by milch.schokokeks.org with ESMTPSA; Wed, 07 Nov 2012 15:00:42 +0100 id 000000000000001A.00000000509A698A.00001392 Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) In-Reply-To: Date: Wed, 7 Nov 2012 15:00:41 +0100 Cc: Etienne Kneuss , Levi Morrison , Anthony Ferrara , Stas Malyshev , Nikita , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: References: <712F4499-949C-4C6F-A142-736A1B156189@gmail.com> <5084281C.9020507@sugarcrm.com> To: Sara Golemon X-Mailer: Apple Mail (2.1499) Subject: Re: [PHP-DEV] Generics proposal From: lars@strojny.net (Lars Strojny) Cool! Looking forward to it. Am 07.11.2012 um 06:41 schrieb Sara Golemon : > Retrying this with reply-to-all. :) >=20 > I think it's an awesome moment for PHP and HipHop to work together! :) > I'll summarize what we have so far into an RFC. >=20 > -Sara >=20 > On Tue, Nov 6, 2012 at 12:50 PM, Lars Strojny = wrote: >> Hey Sara, >>=20 >> can you already show us how your take on Generics would look like? = Maybe this is a good moment for HipHop and PHP to do something together. >>=20 >> Am 06.11.2012 um 04:14 schrieb Sara Golemon : >>=20 >>> Sorry to be late to the conversation, but fwiw, HipHop is adding >>> Generics (and some other cool things) to our PHP implementation. We >>> plan to provide a PHP equivalent implementation in the form of a >>> pre-processor extension which can live in PECL. The implementation >>> would of course be cleaner if done directly in the engine, but with >>> APC the performance hit of doing an extra transformation pass should >>> disappear. Hopefully this satisfies both the want for Java/C++-like >>> syntax without "polluting" the language. >>>=20 >>> -Sara >>>=20 >>> On Tue, Oct 23, 2012 at 4:21 AM, Etienne Kneuss = wrote: >>>> Hi, >>>>=20 >>>> On Tue, Oct 23, 2012 at 4:17 AM, Levi Morrison = wrote: >>>>>>> Especially if the ability was afforded to arrays as well = (function >>>>>>> foo(array $array){})... >>>>>>=20 >>>>>> This would require O(n) runtime tests, I would definitely not go = there. >>>>>=20 >>>>> Actually, it does not require O(n) runtime tests. The solution is >>>>> simple: store the type when it is created. Whenever an element is >>>>> added, make sure it matches the correct type. All this does is = add >>>>> some flat overhead. >>>>=20 >>>> If you test every time you add one element, that's still O(n) tests >>>> where n is the size of the array, the only benefit is that it is = not >>>> checked for each calls to a function. But now we are talking about >>>> attaching non-trivial types to variables, and non-trivial checks in = a >>>> lot of places (think references etc..), let's not go there... >>>>=20 >>>>>=20 >>>>> I am also supportive of the idea of having generics, but I am not = sure >>>>> that the work it would take is worth it. >>>>=20 >>>>=20 >>>>=20 >>>> -- >>>> Etienne Kneuss >>>> http://www.colder.ch >>>>=20 >>>> -- >>>> PHP Internals - PHP Runtime Development Mailing List >>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>>=20 >>>=20 >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>>=20 >>=20 >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20