Re: [PHP-DEV] List of attributes

2020-11-25 Thread Rowan Tommins
On 24/11/2020 23:09, Theodore Brown wrote: That's not necessarily the case for nested attributes. A developer may want to declare that an attribute constructor takes a single attribute with a particular type as one of its arguments. I'm still not sure what the use case for such an attribute

Re: [PHP-DEV] List of attributes

2020-11-24 Thread Theodore Brown
On Sat, Oct 31, 2020, at 5:06 AM, Rowan Tommins wrote: > > This would be an artificial limitation on attributes to patch > > over the inherent inconsistency of the grouped syntax for nested > > attributes. > > There is no artificial limitation; there is a binary choice: does > #[Foo] represent an

Re: [PHP-DEV] List of attributes

2020-10-31 Thread Larry Garfield
On Sat, Oct 31, 2020, at 5:06 AM, Rowan Tommins wrote: > > This would be > >an artificial limitation on attributes to patch over the inherent > >inconsistency of the grouped syntax for nested attributes. > > > There is no artificial limitation; there is a binary choice: does > #[Foo] represent

Re: [PHP-DEV] List of attributes

2020-10-31 Thread Rowan Tommins
On 30 October 2020 21:54:10 GMT+00:00, Theodore Brown wrote: >The fundamental advantage of using an attribute here instead of an >associative array is that it enables IDE autocompletion, and allows >static analyzers to catch any mistakes in the parameter names/types >before the code runs in

Re: [PHP-DEV] List of attributes

2020-10-30 Thread Theodore Brown
On Fri, Oct 30, 2020 at 2:28 PM Rowan Tommins wrote: > On 30/10/2020 18:47, Theodore Brown wrote: > > While passing all nested attributes as an array would at least enable > > consistent semantics, it has the notable disadvantage of preventing > > some use cases from being expressed in PHP's

Re: [PHP-DEV] List of attributes

2020-10-30 Thread Paul Jones
> On Oct 30, 2020, at 14:28, Rowan Tommins > wrote: > >> 3. Vote to switch to a less verbose syntax [...] >>The downside is that... > > Let me stop you there. The downside is that a mob of Internals regulars will > come to your house and lynch you for

Re: [PHP-DEV] List of attributes

2020-10-30 Thread Rowan Tommins
On 30/10/2020 18:47, Theodore Brown wrote: While passing all nested attributes as an array would at least enable consistent semantics, it has the notable disadvantage of preventing some use cases from being expressed in PHP's type system. Specifically, how would you express that an attribute

Re: [PHP-DEV] List of attributes

2020-10-30 Thread Theodore Brown
Hi Rowan and Nicolas (and internals), On Wed, Oct 28, 2020 at 12:57 PM Rowan Tommins wrote: > On 28/10/2020 16:58, Nicolas Grekas wrote: > > about why we'd need nested attributes, here is a discussion about > > nested validation constraints: > > https://github.com/symfony/symfony/issues/38503 >

Re: [PHP-DEV] List of attributes

2020-10-28 Thread Rowan Tommins
On 28/10/2020 16:58, Nicolas Grekas wrote: about why we'd need nested attributes, here is a discussion about nested validation constraints: https://github.com/symfony/symfony/issues/38503 Thanks, it's useful to see some real-world examples. As I suspected, nearly all of these explicitly

Re: [PHP-DEV] List of attributes

2020-10-28 Thread Nicolas Grekas
Hi all! about why we'd need nested attributes, here is a discussion about nested validation constraints: https://github.com/symfony/symfony/issues/38503 You'll see that we're looking hard into ways around using nested attributes, but they all fall short. We actually concluded that we should not

Re: [PHP-DEV] List of attributes

2020-10-23 Thread Rowan Tommins
On 23/10/2020 16:52, Theodore Brown wrote: The problem with this is that it results in inconsistent semantics, where the number of items in an attribute group results in a different type of value being passed. I.e. if you remove two of the three attributes from the list, suddenly the code will

Re: [PHP-DEV] List of attributes

2020-10-23 Thread Benjamin Morel
On Fri, 23 Oct 2020 at 19:08, Michael Voříšek - ČVUT FEL < voris...@fel.cvut.cz> wrote: > We can deprecate comments with "#" in 8.0 or 8.1 > > ... > > Is there anything against excl. BC break of "#" comments? Who is for it? > > I'm all for it, especially considering that it's trivial to fix old

Re: [PHP-DEV] List of attributes

2020-10-23 Thread Michael Voříšek - ČVUT FEL
Wdyt about dedicating "#" char for attributes? We can deprecate comments with "#" in 8.0 or 8.1 and in later version support attributes with "#" single character - without [] brackets, ie. support: #Attribute1 #Attribte2 public function x()... which will be equivalent to: #[

Re: [PHP-DEV] List of attributes

2020-10-23 Thread Theodore Brown
On Tue, Oct 20, 2020 at 10:13 AM Rowan Tommins wrote: > On Mon, 19 Oct 2020 at 16:17, Theodore Brown wrote: > > > > > In theory nested attributes could be supported in the same way with > > the `#[]` syntax, but it's more verbose and I think less intuitive > > (e.g. people may try to use the

Re: [PHP-DEV] List of attributes

2020-10-20 Thread Rowan Tommins
On Mon, 19 Oct 2020 at 16:17, Theodore Brown wrote: > > In theory nested attributes could be supported in the same way with > the `#[]` syntax, but it's more verbose and I think less intuitive > (e.g. people may try to use the grouped syntax in this context, but > it wouldn't work). Also the

Re: [PHP-DEV] List of attributes

2020-10-19 Thread Benas IML
On Mon, Oct 19, 2020, 6:17 PM Theodore Brown wrote: > On Mon, Oct 5, 2020 at 9:24 AM Nicolas Grekas > wrote: > > >> I'm wondering if the syntax that allows for several attributes is > >> really future-proof when considering nested attributes: > >> > >> > >> *1.* > >> #[foo] > >> #[bar] > >> >

Re: [PHP-DEV] List of attributes

2020-10-19 Thread Theodore Brown
On Mon, Oct 5, 2020 at 9:24 AM Nicolas Grekas wrote: >> I'm wondering if the syntax that allows for several attributes is >> really future-proof when considering nested attributes: >> >> >> *1.* >> #[foo] >> #[bar] >> >> VS >> >> *2.* >> #[foo, bar] >> >> Add nested attributes to the mix, here

Re: [PHP-DEV] List of attributes

2020-10-05 Thread Nicolas Grekas
> > Hi Benjamin, hi everyone I'm wondering if the syntax that allows for several attributes is really future-proof when considering nested attributes: *1.* #[foo] #[bar] VS *2.* #[foo, bar] Add nested attributes to the

Re: [PHP-DEV] List of attributes

2020-09-29 Thread Benjamin Eberlei
On Mon, Sep 28, 2020 at 2:58 PM Nicolas Grekas wrote: > > Hi Benjamin, hi everyone >>> >>> I'm wondering if the syntax that allows for several attributes is really >>> future-proof when considering nested attributes: >>> >>> >>> *1.* >>> #[foo] >>> #[bar] >>> >>> VS >>> >>> >>> *2.* >>> #[foo,

Re: [PHP-DEV] List of attributes

2020-09-28 Thread Nicolas Grekas
> Hi Benjamin, hi everyone >> >> I'm wondering if the syntax that allows for several attributes is really >> future-proof when considering nested attributes: >> >> >> *1.* >> #[foo] >> #[bar] >> >> VS >> >> >> *2.* >> #[foo, bar] >> >> Add nested attributes to the mix, here are two possible ways:

Re: [PHP-DEV] List of attributes

2020-09-28 Thread Nikita Popov
On Sun, Sep 27, 2020 at 10:23 AM Nicolas Grekas wrote: > Hi Benjamin, hi everyone > > I'm wondering if the syntax that allows for several attributes is really > future-proof when considering nested attributes: > > > *1.* > #[foo] > #[bar] > > VS > > > *2.* > #[foo, bar] > > Add nested attributes

Re: [PHP-DEV] List of attributes

2020-09-27 Thread Derick Rethans
On 27 September 2020 09:22:48 BST, Nicolas Grekas wrote: >Hi Benjamin, hi everyone > >I'm wondering if the syntax that allows for several attributes is >really >future-proof when considering nested attributes: > > >*1.* >#[foo] >#[bar] > >VS > > >*2.* >#[foo, bar] >Shouldn't we remove syntax

Re: [PHP-DEV] List of attributes

2020-09-27 Thread Rowan Tommins
On 27 September 2020 09:22:48 BST, Nicolas Grekas wrote: >The A. syntax is consistent with the 1. list. >I feel like syntax B is not desired and could be confusing from a >grammar >pov. >BUT in syntax 2., we allow an attribute to be unprefixed (bar), so that >syntax B is consistent with 2. I

[PHP-DEV] List of attributes

2020-09-27 Thread Nicolas Grekas
Hi Benjamin, hi everyone I'm wondering if the syntax that allows for several attributes is really future-proof when considering nested attributes: *1.* #[foo] #[bar] VS *2.* #[foo, bar] Add nested attributes to the mix, here are two possible ways: *A.* #[foo( #[bar] )] or *B.*