Am Mon, 24 Jun 2013 22:30:56 +0200 schrieb Jacob Carlborg <d...@me.com>:
> On 2013-06-24 15:27, Michel Fortin wrote: > > > Not necessarily. There's a couple of Objective-C classes that get > > special treatment by the compiler (identified by a pragma). One > > could do the same for an UDA so the compiler would know where to > > get that value. I'd surely have implemented it as an UDA if such a > > thing existed at the time. > > The thing is that pragmas are tied to the compiler. It knows the > difference between pragma(foo) and pragma(bar). But for UDA's they > are all treated the same, there's no difference between @(3), > @("asd") and @foo from the compiler's point of view (as far as I > understand). You could implement it as a new attribute (that is, not > an UDA), but to implement it as an UDA would be a totally new thing. Maybe it's new in dmd but gdc already has an UDA which is recognized by the compiler: https://github.com/D-Programming-GDC/GDC/blob/master/libphobos/libdruntime/gcc/attribute.d https://github.com/D-Programming-GDC/GDC/commit/afb27a0048cbf51d40abc2810b85641d9e9af9dc The benefit of an UDA is that it does not pollute the global namespace like a normal attribute would.