Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92452 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47936 invoked from network); 19 Apr 2016 12:52:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Apr 2016 12:52:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.161.170 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.161.170 mail-yw0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:35918] helo=mail-yw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/90-43496-B1A26175 for ; Tue, 19 Apr 2016 08:52:43 -0400 Received: by mail-yw0-f170.google.com with SMTP id o66so15543723ywc.3 for ; Tue, 19 Apr 2016 05:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pthreads-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=boPTJhNlHzcr/iKLfiYHiwiRCTLxJ1wVe2/ArBiaO3Q=; b=cq/4WBi2amHGzzCUgaHv+WLrK1XwadIrDC4PajW52+s5zhcOKsIVbU51zSTjm6tkmC N3zJu3wkvSL5fsyeWt+pero4Z3EcjzQ9KxuvCBh52O1jtfwA1RLWrcWWrJATDTeiS9J3 E1xRqAMn39VZb1AYQ8w5XPuCbWa/25IIMyQ05V8svn6MYk/2QS3vZeXt+aLiA4pwmYXo XZ8RFFzsOeRyXWu+P+pbpqhM2KxQuhQ/41HQPnFg1vMhuMOqvrU4r7+FzjWdKcm+lPFP Ay0cMaiNswNvgA6caC8N4ZFqNDHxt3T1UeRBVO6MYwYPZzmWZqE6CSE1TdMeNoSx9rEX HIqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=boPTJhNlHzcr/iKLfiYHiwiRCTLxJ1wVe2/ArBiaO3Q=; b=inM2IBZwYJqPPL7xomL0vx3zdlkVR0mtcPdsis7VlbUtJ5OXsJc/yN2CagksCuB7sG q2cr1SlTDBDCeCm7pv2FOZ7shUwhGBn4h8xLyW0KFsvhC8C3IWL5ADsS5ww+eQiaVZRf sRb53AqDlDx1TOuSKxHWSGGmZCmquyY8guU1zqVkQquJ32ktJ9WNr4nLusETO+R502Q7 T2VsTyntdsEWHPtilL2a42rQBMvBUjr9qeFv3/gCnt5Ak/r4z/EED9zHv2BaM3X1adwp fX0MqqD5hzn+Dy2h9ewtc39aafeZVKO9yHaOYzJmyO0fBaap7gNR/YCbtOg2zv/0IB/b rZ9Q== X-Gm-Message-State: AOPr4FVNBCaE9K+y/xyKRcppH8KVS+BwShbdrzwOxOnPwUhRF+geSSiGXG+egpp5eRqGQ6dDylVe8//Tg+N7LQ== MIME-Version: 1.0 X-Received: by 10.37.30.86 with SMTP id e83mr1363705ybe.79.1461070360524; Tue, 19 Apr 2016 05:52:40 -0700 (PDT) Received: by 10.129.39.9 with HTTP; Tue, 19 Apr 2016 05:52:40 -0700 (PDT) X-Originating-IP: [109.159.6.57] In-Reply-To: References: Date: Tue, 19 Apr 2016 13:52:40 +0100 Message-ID: To: Dmitry Stogov Cc: PHP internals Content-Type: multipart/alternative; boundary=001a1143f39ad4f2eb0530d5f3eb Subject: Re: [PHP-DEV] RFC: Functional Interfaces From: pthreads@pthreads.org (Joe Watkins) --001a1143f39ad4f2eb0530d5f3eb Content-Type: text/plain; charset=UTF-8 Oh, it's confusing text in the RFC, using the word "Interface" ... that's meant as a placeholder for InterfaceName. Cheers Joe On Tue, Apr 19, 2016 at 1:50 PM, Joe Watkins wrote: > Morning Dmitry, > > In your example, they will do the same thing. > > Anon classes don't have lexical scope, I have a patch for that, and an > RFC, I'm just tidying it. > > Even when anon classes do have lexical scope, there is value in being > able to implement these kinds of interfaces using only a function. > > The changes to the vm are restricted to a few lines, that's not > seriously a problem, is it !? > > I don't see where I extend closure with an interface ... > > > zend_do_inheritance_ex(type, zend_ce_closure, 1); > > zend_class_implements(type, 1, interface); > > Cheers > Joe > > On Tue, Apr 19, 2016 at 1:01 PM, Dmitry Stogov wrote: > >> > interface IFoo { >> public function method() : int; >> } >> >> $cb1 = function () implements IFoo : int { >> return 42; >> }; >> >> $cb2 = new class implements IFoo { >> function method() : int { >> return 42; >> } >> }; >> ?> >> >> Are $cb1 and $cb2 going to be the same (do the same)? >> Is this just a new syntax sugar, or a really new feature? >> >> According to implementation, I think, you shouldn't extend "zend_closure" >> with "interface". >> If this is a sugar, lets implement it as a sugar (without VM changes). >> >> But may be I didn't understand the idea at all :) >> >> Thanks. Dmitry. >> >> >> ________________________________________ >> From: Joe Watkins >> Sent: Monday, April 18, 2016 13:22 >> To: PHP internals >> Subject: [PHP-DEV] RFC: Functional Interfaces >> >> Morning Internals, >> >> Please review the following RFC: >> >> https://wiki.php.net/rfc/functional-interfaces >> >> An implementation is provided, and is testable on 3v4l. >> >> Review of the implementation from those of you that do that would be >> good :) >> >> Cheers >> Joe >> > > --001a1143f39ad4f2eb0530d5f3eb--