Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92642 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39668 invoked from network); 22 Apr 2016 14:39:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Apr 2016 14:39:41 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.193 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.192.193 mail-pf0-f193.google.com Received: from [209.85.192.193] ([209.85.192.193:34995] helo=mail-pf0-f193.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/A6-14036-BA73A175 for ; Fri, 22 Apr 2016 10:39:39 -0400 Received: by mail-pf0-f193.google.com with SMTP id r187so10323626pfr.2 for ; Fri, 22 Apr 2016 07:39:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=jasKW/r64cazlPyRbhuaBWzgtxd54JddBpFpOBiljyE=; b=chtpNfIIKH/JnkeicBqlIYuxIIzhv54JwFFWfp3Ur49SBU4RIH9z2TPchC0lO3wtU/ Be5cGsWS4NMEm/HVwO7BgGMTTbTgGK08RGpO8pIrBkW5erSlKugac5OLKngh7pICM69K 5HQCsebb00And1s3KQZz2zt8egiyHi2WGcGLi1cwbpnTRm72LWpgUj2XPQlQ8jNGOQNl aY2EzO6tIAqYws9jcQqdc5b7wfnUN34uyERJwKCuFU6pzzBRbrJ8sn3mrrX3xTn44iPG qO0vgt7XZkydMDCRFjQxDnk26qUDB0zpvPPl0ylx4P30VtEEQoN3C6tDX6YNBolMPG0C eKbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=jasKW/r64cazlPyRbhuaBWzgtxd54JddBpFpOBiljyE=; b=IhNCH9bcWMAp6U4ofCLUhAEP8vF25rjl/V7dbCyJhLr+et5FTRY2zmNOv4e/UrytVi LLVWHbccxTBmnawylokPQIfTA9/qw3q/lLLNMS2W/mNL83+RTWq67oEBzIwMtBdjzoq0 Vt4KV75VVbJPm698yTFWJ1s+5YNX0DRtia0RTGwAH8IkrxuBwXuaaoO6eBcFBTmSnI/r sme8ackLItuuMuSyiRaG+GTEldcV2sG145zMDlidEPF06jxEW+LA1fDTTQ8ICY0PEwwN vFAWTa6i973d7KqkRMJY90uuUYKr7qNPMlDFhtXBiwBSe0ibiFEK0ydG+byaPVc2ql1O /HLA== X-Gm-Message-State: AOPr4FUUYy/CRLTDaaNkwNEAzsZoy3mkP2HuOstqDFpXnRUJyfWQRPCK00W5lxmW7eblcXVJr9Hmyi0zflOrgw== MIME-Version: 1.0 X-Received: by 10.98.86.77 with SMTP id k74mr28477438pfb.28.1461335976120; Fri, 22 Apr 2016 07:39:36 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.66.132.79 with HTTP; Fri, 22 Apr 2016 07:39:36 -0700 (PDT) In-Reply-To: <5719EA39.2070408@seld.be> References: <5719EA39.2070408@seld.be> Date: Fri, 22 Apr 2016 08:39:36 -0600 X-Google-Sender-Auth: Nh5QrW7wPuPvdpo1jOXlVzzHlNs Message-ID: To: Jordi Boggiano Cc: internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV][RFC] Callable Types From: levim@php.net (Levi Morrison) > Not much else to say, the syntax reads a bit weird/heavy being all in-line > with the function signature but at the same time I can't imagine how else it > would work that would be any better. As mentioned on Reddit and in the future scope section of union types, we may want to introduce named type expressions: type IntReducer = callable(int, int): int; Which would also allow unions (if passed, of course): type Iterable = Array | Traversable; It would also allow for a general type-aliasing mechanism for single names. This feature has been asked for in the past but I can't remember the use-cases so this example is not very good: type Foo = SomeFoo; Then we just use the names where we would have put the expressions: function reduce(int $a, int $b, IntReducer $reducer): int { return $reducer($a, $b); }