Simple @tagged attribute for unions [OT]

Bruno Medeiros brunodomedeiros+spam at com.gmail
Tue Dec 7 08:59:55 PST 2010


On 20/11/2010 00:10, Andrew Wiley wrote:
> On Fri, Nov 19, 2010 at 5:46 PM, Bruno Medeiros
> <brunodomedeiros+spam at com.gmail> wrote:
>
>     On 22/10/2010 04:04, Andrei Alexandrescu wrote:
>
>         On 10/21/2010 08:41 PM, bearophile wrote:
>
>             I have suggested yet another attribute, @tagged:
>             http://d.puremagic.com/issues/show_bug.cgi?id=5097
>
>             Bye, bearophile
>
>
>         And almost exactly six hours ago:
>
>             On the other hand, currently there are many D2 features that are
>             unfinished and buggy, so adding even more stuff is not a
>             good idea.
>             And I think named arguments are a purely additive change. So
>             Walter
>             may add them later when the current features are implemented
>             well
>             enough. Currently it's much more important to focus on
>             eventually
>             needed non-additive changes instead.
>
>
>         Hope you agree with yourself :o).
>
>
>         Andrei
>
>
>     How did I miss that! It's bearophile's best comment ever! :D
>
>
>
> This isn't really related but it's an idea that I randomly had while
> reading that bug report:
> What if functionality like this could be implemented in mixins rather
> than compiler-defined annotations? The idea would be that an annotation,
> when applied to something, would be "instantiated" in some form,
> allowing it to mixin code somehow. I know that's vague, but it seems
> like it would have powerful applications for things like ORM libraries
> and other libraries.
> On the other hand, annotations go from metadata to something that
> potentially changes the code you're writing, which may not be a good idea.
>
> Disclaimer: This is utterly random and you're free to tell me it's
> foolishness.
>

That would effectively be a form of macros, using annotations instead of 
function-call-like syntax.
In the earlier stages of D (D1) there were plans to add at some point 
some form of macros (AST macros), working kind like implicit mixins. But 
with all the D2 stuff it got pushed way back in the new features 
wishlist (informally speaking, to D3). The general interest for that 
feature might have waned. I personally was never too keen on that, in 
fact I was (and still am) a bit apprehensive about such a feature.


-- 
Bruno Medeiros - Software Engineer


More information about the Digitalmars-d mailing list