On Tue, Nov 4, 2014 at 12:20 PM, Pierre Joye <pierre....@gmail.com> wrote:

>
> On Nov 4, 2014 8:54 PM, "Benjamin Eberlei" <kont...@beberlei.de> wrote:
> >
> > On Tue, Nov 4, 2014 at 11:28 AM, Pierre Joye <pierre....@gmail.com>
> wrote:
> >>
> >> On Tue, Nov 4, 2014 at 4:21 PM, Stas Malyshev <smalys...@sugarcrm.com>
> wrote:
> >> > Hi!
> >> >
> >> >> As I do consider personal tastes important, there are times where we
> should
> >> >> listen to our users.
> >> >
> >> > It would be nice to take "paving the walkways" approach, but last time
> >> > we tried, IIRC we've got into something very over-engineered. Maybe if
> >> > we try again with more restricted scope (i.e. not trying to put a DSL
> >> > for describing arbitrarily complex data structures into it :) it would
> >> > be more successful this time.
> >>
> >> All projects mentioned in this thread use:
> >>
> >>
> http://doctrine-common.readthedocs.org/en/latest/reference/annotations.html
> >>
> >> That makes a pretty good base spec.
> >
> >
> > Being the author I can say, the doctrine annotations project is way too
> over-engineered/special-purpose to land in core.
> >
> > I agree with Stas that a much simpler approach is probably realistic.
> >
> > beginning pure speculation here, i see a short array like syntax like:
> >
> > [foo="bar", bar="baz", baz=["key": "value"]]
> > function annotated_fn() {}
> >
> > Maybe even exactly short array syntax:
> >
> > ["foo"="bar", "bar"="baz", "baz"=["key": "value"]]
> > function annotated_fn() {}
> >
> > Then $reflectionFunction->getAnnotations() returns an array. Various
> PHP/Userland libraries and frameworks can then stick whatever symantic on
> top that they want.
>
> Yes, that was what discussed last time too and makes perfectly sense.
>
> I only not sure about the syntax. I do not like that one f.e. not really
> in phase with what exists (doctrine or other languages).
>
The problem with this simple approach is namespacing to avoid clashes, any
solution to incoperates that introduces lots of complexity like allowing
"new Annotation" inside the array definition.

However I guess now that for example composer provides namespaces for
packages, the community could come up with a convention to namespace by
composer package name to allow something like:

["doctrine/orm": ["entity"]]
class User
{
    ["doctrine/orm": ["id", "generatedvalue", "column": ["type":
"integer"]]]
    public $id;
}

The simplicity here is really key. Validation and mapping of this is much
easier implemented in userland code.

> Cheers,
> Pierre
>

Reply via email to