Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63882 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3194 invoked from network); 15 Nov 2012 15:39:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Nov 2012 15:39:51 -0000 Authentication-Results: pb1.pair.com header.from=juzna.cz@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=juzna.cz@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: juzna.cz@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qc0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:32786] helo=mail-qc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/43-07334-5CC05A05 for ; Thu, 15 Nov 2012 10:39:50 -0500 Received: by mail-qc0-f170.google.com with SMTP id d42so1214415qca.29 for ; Thu, 15 Nov 2012 07:39:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=JQRhWMbcOEyNn8PVbNFZ9NHAJgtLX+kJntKMtSVCRg8=; b=CcLrEjrLGuxg0NlDMq8TuMpWkZJ/4GCjpWR7TrcyYzMZtG5Q107jThqjW1gkv84K5G mDyCnD8uC0vPlVbMNy5mqJ1n+4T9W8K5w8hrHxu8rzZ/v0tBz9E1QXkDrR43eBoIAdDk Y9ceA6euRM//yn2y0aEM5WHGjCE6dN/Jbr/6UCnGYTi9GxSZ4nyie8+0BGKOLAo5gAOl 2s6ydFkhYliSRXg2VXu3aatYYEUtjvNARpgndgEK/4qHiFidL8ZC0i1HqhZQWMpjueEZ gS8mHYZ00TYlIbo0c8MnDqKz144ififnxxwsjBtObCGBv3HwTpTv2kZtoy1VpMlUxSLT wO9g== Received: by 10.224.60.18 with SMTP id n18mr1494915qah.36.1352993986529; Thu, 15 Nov 2012 07:39:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.224.100.65 with HTTP; Thu, 15 Nov 2012 07:39:26 -0800 (PST) In-Reply-To: References: <712F4499-949C-4C6F-A142-736A1B156189@gmail.com> <5084281C.9020507@sugarcrm.com> Date: Thu, 15 Nov 2012 16:39:26 +0100 Message-ID: To: Sara Golemon Cc: Lars Strojny , Etienne Kneuss , Levi Morrison , Anthony Ferrara , Stas Malyshev , Nikita , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=20cf3074d566f3497604ce8a75aa Subject: Re: [PHP-DEV] Generics proposal From: juzna.cz@gmail.com (Jan Dolecek) --20cf3074d566f3497604ce8a75aa Content-Type: text/plain; charset=UTF-8 Hi Sara, any progress with your RFC? Can't wait to see it. Thanks Jan Dolecek juzna.cz@gmail.com On Wed, Nov 7, 2012 at 6:41 AM, Sara Golemon wrote: > Retrying this with reply-to-all. :) > > 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. > > -Sara > > On Tue, Nov 6, 2012 at 12:50 PM, Lars Strojny wrote: > > 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. > >> > >> -Sara > >> > >> On Tue, Oct 23, 2012 at 4:21 AM, Etienne Kneuss wrote: > >>> Hi, > >>> > >>> On Tue, Oct 23, 2012 at 4:17 AM, Levi Morrison < > morrison.levi@gmail.com> wrote: > >>>>>> Especially if the ability was afforded to arrays as well (function > >>>>>> foo(array $array){})... > >>>>> > >>>>> This would require O(n) runtime tests, I would definitely not go > there. > >>>> > >>>> 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. > >>> > >>> 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... > >>> > >>>> > >>>> I am also supportive of the idea of having generics, but I am not sure > >>>> that the work it would take is worth it. > >>> > >>> > >>> > >>> -- > >>> Etienne Kneuss > >>> http://www.colder.ch > >>> > >>> -- > >>> PHP Internals - PHP Runtime Development Mailing List > >>> To unsubscribe, visit: http://www.php.net/unsub.php > >>> > >> > >> -- > >> PHP Internals - PHP Runtime Development Mailing List > >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --20cf3074d566f3497604ce8a75aa--