Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63767 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49076 invoked from network); 6 Nov 2012 20:51:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2012 20:51:09 -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:57005] helo=milch.schokokeks.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/53-25645-73879905 for ; Tue, 06 Nov 2012 15:51:06 -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; Tue, 06 Nov 2012 21:51:00 +0100 id 0000000000000026.0000000050997834.00005214 Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) In-Reply-To: Date: Tue, 6 Nov 2012 21:50:58 +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) Hey Sara, 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. Am 06.11.2012 um 04:14 schrieb Sara Golemon : > 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 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20