The future of UDAs.

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Nov 29 06:17:40 PST 2012


On 11/29/12 6:44 AM, foobar wrote:
> On Thursday, 29 November 2012 at 10:25:40 UTC, Walter Bright wrote:
>> On 11/29/2012 6:40 PM, Jacob Carlborg wrote:
>>> On 2012-11-29 03:00, Walter Bright wrote:
>>>
>>>> An attribute would bring along with it the notion of having some static
>>>> constructors care about dependencies and others not. A pragma would be
>>>> global to the module.
>>>
>>> Why can't the attribute be global to the module?
>>>
>>
>> Because attributes attach to the declarations they enclose. A global
>> attribute would be something else.
>
> What's wrong with attaching the annotation to the module declaration?
> i.e.
> @no_circular_ctors module foobar;

I think this entire approach is unprincipled (aside from solving a 
problem that's not urgent and not important). We shouldn't focus on the 
_syntax_ of the completely unprincipled approach, but instead on 
improving it.

A possibly better approach would be e.g. to do a simple analysis of the 
static constructor's use of symbols, and use that set to decide whether 
two static constructors must be ordered or not.


Andrei




More information about the Digitalmars-d mailing list