Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108498 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96530 invoked from network); 11 Feb 2020 21:08:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Feb 2020 21:08:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6666C18055E for ; Tue, 11 Feb 2020 11:22:55 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 11 Feb 2020 11:22:54 -0800 (PST) Received: by mail-ot1-f49.google.com with SMTP id j16so577798otl.1 for ; Tue, 11 Feb 2020 11:22:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hkXbah/uJ/nSrRUioYwHVM55FNnx3cNnzpmyUiT1/zc=; b=Wy+Yt6gdwA7QpzND4lojnqS0xAdJ0GY5ZwpJU490+wA94dVBUSFBsDmUHeQ2rQrx5g DLtsWM8jjw2ihRxenl1Y+CqNRwGLk49AIjDZViqyMxsMRv8cIxFQ8sABZBq/K1x0iH6C YpwM8VkLelDdroEkhLZgxm9vckKOC1ACPHgLYfAZ9BmxODc/1yob7fx9RQTeO0qitGDM an+B/J7XvIkcQoLBVuMiI9h9V7r/bynJIm13bkDdobM1XI9dXqu8z8LXmSVEgXDWzbKn y+rxmp2SrowkXdxzcSgIiHhHs5aXFYssM99hCD2HuBYx4upOchFTz3W50SOFSXW0NSu/ MXPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hkXbah/uJ/nSrRUioYwHVM55FNnx3cNnzpmyUiT1/zc=; b=fZvxwD2MP7OwoLpI8zmE23GfWi+qbtvodCLso+IYWd/IUeLMld1y1wEpSs3VZTZxjl TohqagL4EqGn+t4CiNW0+GA/wgGK2FE1bYqn1DdlvPY4eT6FMnFuW7ejXMwyBMwS1cT2 egyKvKjeltWU2s1lJE8e8eKXvJNLNsZJH1y4bKevxvhgNNeYV8ZX9tlUYCaMmJ7FnAwO QxLX+AYSP5b+NKOXTc+oWBpCANtPcWS0m0xl3F+5FoKo14//iA+I6Qh6Oja7QHXLQYYn VMFFFzgNfiLHPETnkrAotyFAFRd8uOY7lLmvJFlk5NkYdiFjqsvkKxUcNBmu6yJTW/My +Kaw== X-Gm-Message-State: APjAAAV8AArZWEayT5F08fggNVsiUt1WVSvEB/xtzx0U3sZj1DhUZTsa JpS8zsx/drk7cPwLWYjLW8ZN/SDdxpg8whIPB1I= X-Google-Smtp-Source: APXvYqzkrW2jyZSNshKpCCxLpoBMBLE2+otbptGZK2uqg5STpxKceUWTVegL56InRjuAiXE/tJmypAOAcirNevFvhDU= X-Received: by 2002:a05:6830:1498:: with SMTP id s24mr6739885otq.79.1581448973670; Tue, 11 Feb 2020 11:22:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 11 Feb 2020 20:22:41 +0100 Message-ID: To: Dik Takken Cc: PHP Internals List , Larry Garfield , Dan Ackroyd Content-Type: multipart/alternative; boundary="0000000000004e5d88059e51c8fa" Subject: Re: [PHP-DEV] [RFC] From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --0000000000004e5d88059e51c8fa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable wt., 11 lut 2020, 20:08 u=C5=BCytkownik Dik Takken napisa=C5=82: > On 11-02-2020 17:48, Dan Ackroyd wrote: > > I didn't include the following in that RFC, because I thought it would > > be too controversial, but I think it's worth considering a new syntax > > for this. > > > > Given the code: > > > > function foo(); > > class Zoq { > > public function Fot() {} > > public static function Pik() {} > > } > > $obj =3D new Zoq(); > > > > > > Then these: > > > > $(foo); > > $($obj, Fot); > > $(Zoq, Fot); > > > > Would be equivalent to: > > > > Closure::fromCallable('foo'); > > Closure::fromCallable([$obj, 'Fot']); > > Closure::fromCallable('Zoq::Fot'); or Closure::fromCallable(['Zoq', > 'Fot']); > > > > Or similar. > > Given the fact that $() would only accept functions and methods as > argument, this idea could be taken one step further by writing: > > $(foo); > $($obj->Fot); > $(Zoq::Fot); > > Referring to a method like this is normally not possible because it is > ambiguous. However, wrapped inside $(), which only accepts functions and > methods, the ambiguity disappears. > > The $() syntax is nice and short. And something completely new. As new > syntax can only be 'spent' once, more familiar alternatives should be > explored as well. Thinking about the existing list() and array() syntax, > another possibility could be: > > closure(foo); > closure($obj->Fot); > closure(Zoq::Fot); > It looks like a function but it's not a function cause what you have inside parentheses looks like a const, property and class const. IMO a statement like that for consistency it should be with no parentheses like: $foo =3D closure foo; $foo =3D closure $obj->Fot; $foo =3D closure Zoq::Fot; Cheers, -- Micha=C5=82 Brzuchalski > --0000000000004e5d88059e51c8fa--