Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63771 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75569 invoked from network); 7 Nov 2012 05:42:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2012 05:42:01 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.210.170 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.210.170 mail-ia0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:49790] helo=mail-ia0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9A/51-57873-6A4F9905 for ; Wed, 07 Nov 2012 00:42:00 -0500 Received: by mail-ia0-f170.google.com with SMTP id e16so989052iaa.29 for ; Tue, 06 Nov 2012 21:41:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=jUcz7ycLn0IyWvsS/63uoenHBHIwMpbcOzfqJO4tF6Y=; b=JjuU6KXkHPgFDN3AyNPerVqR2diqBrJpBcjMcuuTrdZ4pQ6JawfgqdbxNfpqtrdpCJ Is34GSahsqfm6cw4937YqQUS1AIWS4nDa6SRfKNm76ZbeiXPgE/C9ghBtE+ApxIBk5hF 0aX9bPTX2Y0Qe6QUUquFLZHRGN6+chfUd6j+dphUd3VyeXl0i9GADL6llMrR15cgpK1L c7+pPmjzw7oml6h38Q1a/Njj99qCPjP29VT4z1HdEaS5LymN4w6fKdSVeP6R7GczKva7 k+knrcCYzqN0nAZsAxbT5tEulZ0uZ/8BRhfTZFX6WZ/aJSMmcAsevE+pf0+47rhk6MMI bCWg== MIME-Version: 1.0 Received: by 10.50.89.162 with SMTP id bp2mr990051igb.7.1352266915853; Tue, 06 Nov 2012 21:41:55 -0800 (PST) Sender: php@golemon.com Received: by 10.64.21.193 with HTTP; Tue, 6 Nov 2012 21:41:55 -0800 (PST) X-Originating-IP: [98.210.180.187] In-Reply-To: References: <712F4499-949C-4C6F-A142-736A1B156189@gmail.com> <5084281C.9020507@sugarcrm.com> Date: Tue, 6 Nov 2012 21:41:55 -0800 X-Google-Sender-Auth: HsVb6zLsmLIV6MBbkCTm9pgs-x8 Message-ID: To: Lars Strojny Cc: Etienne Kneuss , Levi Morrison , Anthony Ferrara , Stas Malyshev , Nikita , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmRxoTklMIBVz4dKFDsh0HpH+C9OZgk5WLOtIRvhE4f/DwKfJHVNAsaX4S5BT05F2kkbHGp Subject: Re: [PHP-DEV] Generics proposal From: pollita@php.net (Sara Golemon) 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 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 >> >