Fixing cyclic import static construction problems
Peter Alexander
peter.alexander.au at gmail.com
Fri Nov 30 02:05:19 PST 2012
On Friday, 30 November 2012 at 01:07:57 UTC, Andrei Alexandrescu
wrote:
> On 11/29/12 5:43 PM, Walter Bright wrote:
>> On 11/30/2012 12:09 AM, Daniel Murphy wrote:
>>> I don't think this is sufficient. Imagine a group of modules
>>> that really
>>> _do_ have a cyclic dependency, and a mixin that adds an
>>> independent
>>> static
>>> this. Ideally you'd be able to mark the mixed-in constructor
>>> as
>>> independent
>>> without tainting the whole module.
>>>
>>> So just make the pragma apply to declarations, you either
>>> mark specific
>>> functions (which can then be mixed in) or put `pragma(...):`
>>> at the
>>> top of
>>> your module and you get your behaviour.
>>
>> It is possible for each static constructor to specify
>> independently of
>> the other static constructors which imports must be
>> constructed first.
>> But do we really want to go that far?
>
> I think we either do it right or leave it as it is. It's not
> like there's no workaround so if we take a stand here we better
> have something compelling.
>
> Andrei
+1
FWIW, I think this proposal sounds like a massive hack. Not a fan.
More information about the Digitalmars-d
mailing list