On Monday, October 17, 2016 14:12:33 timepp via Digitalmars-d-learn wrote: > there is "@disable", using @ as prefix; > there is "__gshared", using __ as prefix; > there is also "align", not using prefix. > > I failed to summarize a rule here. Can anyone tell the underlined > philosiphy?
There really isn't one. __gshared is probably the way that it is, because it's not something much of anything but C bindings should be using (it exists solely for compatibility with C global variables). So, it's treated as a compiler thing (like __traits) rather than a normal attribute. But as for @, what that pretty much comes down to is that Walter didn't want to add more keywords. So, new ones got @ put on them (and all of this was well before user defined attributes came along). In general, folks don't like the fact that there is no consistency between what has @ and what doesn't, but no one can come up with a scheme that's actually fully consistent (at least, not without slapping @ on all attributes or having it on none), and it would break a ton of code if any of them were changed now, so it's highly unlikely that any of them will ever change. So, you just learn which ones have @ and which don't, and then it mostly doesn't matter anymore, as annoying as it may be from an aesthetic point of view. - Jonathan M Davis