Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63187 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9973 invoked from network); 20 Sep 2012 09:05:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Sep 2012 09:05:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:49263] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/22-15057-B6CDA505 for ; Thu, 20 Sep 2012 05:05:48 -0400 Received: by obbwc18 with SMTP id wc18so2113238obb.29 for ; Thu, 20 Sep 2012 02:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=ZFqM1abX9vN6K226EkORopi15U6h1NkgL9TkffoxAHc=; b=KnO/KJ41KRfsw4lluuna6cY6DNUAb6cYjmYgIqcyzNmCrfj856SpERXEhyJQK2rGz/ 5ra53r8zZl4phA9F/RhotgKKP47SP06dPL4zfuRyed3MEqA+MixBFLJ3UJKzH0fq31SI e8qPRIOo2HyE1v36vj8VShEFGZpMS35BGI0WI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=ZFqM1abX9vN6K226EkORopi15U6h1NkgL9TkffoxAHc=; b=HpO1qXe05rofVWjOVQi52Dfkl2qvJuK2QVtiURn4qg6hHEkTFkhowzOF6awv4T4i8Z KvoF+QjR3VSEdt0oBmxpZZyjy8I5NyP/tC6VTTV4ACgzid9v9dYsXmeA3O2EESzN6waM UeM8555VBclikS3c0pHq9V6M1gVoHQdpETuYu37qCyFVrlQHU9heQIDAwDqnLuaUm6mn CiS/E/Jd/bQ+ETYzvD9oNZx7SWvO0ipswC4YJprOgKgUfZQHMTqu3a41JzSLeZQsEo7P Zg6p7i1lu5rJ6aqSpIh+/ae7hUhs2IYZ+dU2JrJ1wcbcqV8ziI6v7XcZO5nWjvzzMS1S hyQA== Received: by 10.60.171.69 with SMTP id as5mr802734oec.100.1348131944900; Thu, 20 Sep 2012 02:05:44 -0700 (PDT) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.76.171.131 with HTTP; Thu, 20 Sep 2012 02:05:24 -0700 (PDT) In-Reply-To: <505AD2D8.8090701@hoa-project.net> References: <50593266.5010802@mrclay.org> <5059FE96.7080406@ajf.me> <505A074C.70501@mrclay.org> <505A085E.1050808@ajf.me> <505A0D3F.3040604@mrclay.org> <505AD2D8.8090701@hoa-project.net> Date: Thu, 20 Sep 2012 17:05:24 +0800 X-Google-Sender-Auth: hM3Wcww7SF_9wUVJuBmEfLcnN6A Message-ID: To: ivan.enderlin@hoa-project.net Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQmSEvwabvdzO8nfrZoN9xxxiywd/U0wiX/ViP8+EOZ4uE5WM9JJum9KWjWwV+r9jgFW4WJY Subject: Re: [PHP-DEV] RFC: alternative callback syntax From: aharvey@php.net (Adam Harvey) On 20 September 2012 16:24, Ivan Enderlin @ Hoa wrote: > >> On 9/19/12 2:01 PM, Andrew Faulds wrote: >>> $cb =3D {mysql_real_escape_string}; >>> $cb =3D &{mysql_real_escape_string}; > > These notations are just horrible. Agreed. They're very line noisey and non-obvious. > PHP has recently introduced ::class to resolve a classname (namespace Foo= ; > A::class // Foo\A). The =E2=80=9C::=E2=80=9D was originally a resolution = operator for calls, > but now, it is also used for names (which sounds good for me). Here, you > propose the new notation ::function, which can be understood as: =E2=80= =9Cresolve > this function or method as a callable=E2=80=9D. We stay in a resolution c= ontext. It > is consistent regarding to the evolution of this operator. I like ::callable, personally, since it suggests the resulting type, but ::function would also be OK by me. > Another consistent notation is the cast: (callable) $obj->bar;. I think the analogy with ::class is stronger than the analogy with type casting (since it's not a variable or literal), although I'm not really too fussed either way. In terms of the feature itself (since I haven't weighed in yet), I think it's a reasonable piece of syntactic sugar, although I'd definitely want to see a patch before voting. :) Adam