static this(), interdepencies, and bootstrapping

Lars Ivar Igesund larsivar at igesund.net
Sun Aug 3 09:29:37 PDT 2008


Derek Ney wrote:
 
> I know that this "ordering" of static this() calls was added to 2.0
> presumably because people did not like the non-deterministic order in
> which they were called. 

The ordering is not new in 2.0, and has been well defined in the spec since
the start.

static this are called in lexical order, and static ~this in opposite
lexical order. Without this it would be impossible to have runtime
initialized data depending on other data, which probably is the more common
usecase.

And FWIW, circular dependencies are never a good idea if avoidable.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango



More information about the Digitalmars-d mailing list