Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92409 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12557 invoked from network); 18 Apr 2016 11:53:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2016 11:53:28 -0000 Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.161.177 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.161.177 mail-yw0-f177.google.com Received: from [209.85.161.177] ([209.85.161.177:36201] helo=mail-yw0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C0/26-11975-4BAC4175 for ; Mon, 18 Apr 2016 07:53:25 -0400 Received: by mail-yw0-f177.google.com with SMTP id o66so199437249ywc.3 for ; Mon, 18 Apr 2016 04:53:24 -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=iZBP3LeU3R31+jVEtlNCOFwHLQk+KgV8zuh7LkyfY8c=; b=PHJttOla/44E74GqO4hUw652LkxFbmJVOfD0ntALO7TYMngez2VllgYzMIvJbfPZgk dzyPudgL32asC4kM0MQJmUfvWsTPkA5UtrmZp2GiIj1CR8FMZ2jP4Edn1NxyVeYQTmJf 8Lq3FqNJxP4S7Jmz2EgMC/n3lWDnNPgrpZPWTjPjcQXZ6GfPcMTK7yYkIhPP4nZpz7iP Am4nrjszXy86FfetMBA/Z9Aupgtf/0nNOJkxj+OwnJyIZfFW3ae8LSgr7M0q877OXw32 /hPFcrqNihASssYtVX4Kpjomdn04WlUvS5IVWFsN22ndIIQmvr/YW/D2f6X7Jln4YeDU j6iA== 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=iZBP3LeU3R31+jVEtlNCOFwHLQk+KgV8zuh7LkyfY8c=; b=OqCHyPhE35oP0Mt7SZ8jW8nTRslW+yTBhdaYFbn3oz2es+RmggwUkQ8EaRVNflCdM8 FD9AIKGsBrxPZZs2R7fLFQ+oupN5zOTVzB8ARswg4xn4NbsaVFB5GwlTSwIrki56OKTk lXf5+cTnbsYYS+JThOT85XRB+9XrbD33XCesspJvWpLQfuhbHFrNQvsvB+rr2fmuB+Am BBxBg6+O61x8kgfrJGiYEzsIk13ZVEYkedQMc9Yz8yKbUTO1Ma44RYl1uagTobBqva7R 7iMLKg+NyJoQOv/NwgeKIc0pzMsX2n/l99zdwmnIqqlxJ1+oa0cX6F0/bqlWHh/OLRPx /JQg== X-Gm-Message-State: AOPr4FXR0W2OXwjjDwYw6VEadkXRWNEuD/iCrl9AXAKREe9+qGLjUZbB8O11NgnVyGd2pmSC8kL6mHYSTWjJwQ== MIME-Version: 1.0 X-Received: by 10.129.44.139 with SMTP id s133mr22266948yws.182.1460980401714; Mon, 18 Apr 2016 04:53:21 -0700 (PDT) Received: by 10.129.39.9 with HTTP; Mon, 18 Apr 2016 04:53:21 -0700 (PDT) X-Originating-IP: [109.159.6.57] In-Reply-To: <5714C647.7030505@gmail.com> References: <5714C647.7030505@gmail.com> Date: Mon, 18 Apr 2016 12:53:21 +0100 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary=001a1141e82ade706e0530c101e5 Subject: Re: [PHP-DEV] RFC: Functional Interfaces From: pthreads@pthreads.org (Joe Watkins) --001a1141e82ade706e0530c101e5 Content-Type: text/plain; charset=UTF-8 Morning, > I must admit to being a bit confused by the term "functional interface" at first, though, > because "functional" has so many different meanings - is this a term used elsewhere, > or is it up for debate? The terminology is borrowed, Java 8 uses lamdas to implement specially annotated interfaces, it refers to them as functional interfaces. The other term is SAM ... but it feels a bit strange to give code a people name, right ? :) Single Abstract Method Interface Implementations is just ... too much ... I find it to be a pretty concise description, although the wording of the errors is definitely flexible. The "non thing" wording was only chosen because it's used elsewhere in the core, "non static" and so on. It just feels a bit strange to say or think "functional interface", but once you get over that ... As far as anyone who is not familiar with the workings of PHP is concerned, what they have is a function that implements an interface, functional interface is a pretty good description of that. Cheers Joe On Mon, Apr 18, 2016 at 12:34 PM, Rowan Collins wrote: > Joe Watkins wrote on 18/04/2016 11:22: > >> Please review the following RFC: >> >> https://wiki.php.net/rfc/functional-interfaces >> >> An implementation is provided, and is testable on 3v4l. >> > > This sounds like a really nice feature. As well as using functions to > implement existing interfaces, it gives a nice way of typehinting the > requirements of a callback without forcing users to create an object. > > I must admit to being a bit confused by the term "functional interface" at > first, though, because "functional" has so many different meanings - is > this a term used elsewhere, or is it up for debate? > > In particular, the error message "Fatal error: cannot implement non > functional interface IFoo" makes me wonder what's "non-functional" about > the interface. It would be clearer to me if it was more specific and > avoided the jargon, e.g. "Anonymous function cannot implement interface > with more than one method". > > The error "functional interface cannot implement self" also seems > inconsistent with the others - here "functional interface" refers to the > *implementation*, not the interface. It might be clearer to just say > "cannot implement non interface self" anyway - there's nothing actually > special about "self" here, it's just another example of trying to use a > class as an interface, which is illegal whatever the implementation. > > These are of course minor details, and the rest of the feature as > described sounds great. :) > > Regards, > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a1141e82ade706e0530c101e5--