Re: [RFC] First-class callable syntax

From: Date: Thu, 20 May 2021 21:31:50 +0000
Subject: Re: [RFC] First-class callable syntax
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-114548@lists.php.net to get a copy of this message
On 20/05/2021 21:54, Kamil Tekiela wrote:
This would be less confusing than the (...) syntax IMHO. Of course this still has the same ambiguity as Rowan points out. Is ::$objA->methA a property or a method? We could solve this problem by specifying the syntax to always refer to methods/functions. Parentheses could be used to enforce access to property, e.g. ::($objA->methA) would evaluate the value stored in the public property of the object $objA
This is precisely the kind of "solution" that I referred to as easy for the parser but confusing for humans. ::$objA->methA // method (::$objA->methA) // method ::($objA->methA) // property ::($objA)->methA // method? (::$objA)->methA // attempt to access a property of a Closure object? It's just a mess, IMHO Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#114548) next »