On Sun, Sep 27, 2020 at 10:23 AM Nicolas Grekas <nicolas.gre...@gmail.com>
wrote:

> Hi Benjamin, hi everyone
>
> I'm wondering if the syntax that allows for several attributes is really
> future-proof when considering nested attributes:
>

I feel this question is what an RFC for nested attributes has to weigh. We
have established that in practice nested is possible syntax wise.
Personally I am not interested in introducing nested attributes, because
they would allow a complexity in attribute usage that might be better
handled by actual configuration files (XML, JSON, YAML, INI choose your
poison).

As such I am not looking into working on this addition myself and haven't
put any thought into the actual syntax.

In general we have not established yet if the support for nested attributes
would get a super majority of voters and its increased complexity is the
major reason why I opted to leave it out of the original RFC.

For Doctrine ORM for example I prototyped this new attribute based driver
that flattens the structure so that nested attributes are not needed
https://github.com/doctrine/orm/pull/8266 - without making the usage less
clear (in my opinion).

>
>
> *1.*
> #[foo]
> #[bar]
>
> VS
>
>
> *2.*
> #[foo, bar]
>
> Add nested attributes to the mix, here are two possible ways:
>
>
> *A.*
> #[foo(
>     #[bar]
> )]
>
> or
>
>
> *B.*
> #[foo(
>     bar
> )]
>

I'll throw a few more options into the mix

- #[foo(bar())]
- #[foo(#bar())]
- #[foo(new bar())]


> 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.
>
> Shouldn't we remove syntax 2. in 8.0 and consider it again when nested
> attributes are introduced?
>
> I voted yes for syntax 2. when the attributes were using << >>. I would
> vote NO now with the new syntax.
>
> Nicolas
>

Reply via email to