Custom attributes (again)
deadalnix
deadalnix at gmail.com
Fri Apr 6 07:55:17 PDT 2012
Le 06/04/2012 12:23, Manu a écrit :
> On 6 April 2012 10:48, Walter Bright <newshound2 at digitalmars.com
> <mailto:newshound2 at digitalmars.com>> wrote:
>
> On 4/6/2012 12:35 AM, Alex Rønne Petersen wrote:
>
> It actually can be a problem. In .NET land, there are many
> attributes across
> many projects (and even in the framework itself) with the same
> names. It turns
> out that regular namespace lookup rules alleviate this problem.
>
>
>
> Perhaps a better scheme is:
>
> enum foo = 3;
>
> ...
>
> @attr(foo) int x;
>
> That way, foo will follow all the usual rules.
>
>
> What about:
>
> struct editor
> {
> this(string name, EditType, Colour = Colour.Default, string
> description = null)
> {
> //...
> }
>
> blah blah blah
> }
>
> @attr(editor("thing",...blah...))
>
> I don't see the advantage over:
> @editor(...)
>
> ?
+1 I see no additional benefit for this. D have very good lookup rules
for looking symbols into modules, so let's use them.
More information about the Digitalmars-d
mailing list