using enums as key in associative array

Wilfried Kirschenmann wilfried.kirschenmann at gmail.com
Tue Mar 8 07:59:54 PST 2011


>>
>> I really don't understand your problem with module constructors. They're
>> fantastic.
>
> I may be wrong, but I think this point of view is a "where I can from"
> statement. C's char* are fantastic when you have never used a PL with
> builtin strings. There are languages in which you don't need to list twice
> everything just to have them available at import time.
>
> // data definition
> X foo;
> Y bar;
> Z baz;
> ...
> static this {
>   foo = ...;
>   bar = ...;
>   baz = ...;
>   ...
> }
>

The question is : what are in the dots :
static this {
// get information from environment
...
// load information from a module configuration file
...
// make some complex computation
...

// initialize data in any order
baz = ...;
bar = ...;
foo = functionOf(baz, bar);
}

This way, you have made independent the initialization of a module
from the initialization of the user's application.

However, I agree to the fact that for statically known value (such as
my first example), this far from optimal.

Wilfried


More information about the Digitalmars-d-learn mailing list