Feature request - simpler constructors

Daniel Keep daniel.keep.lists at gmail.com
Fri Sep 21 17:59:05 PDT 2007



Robert Fraser wrote:
> Daniel Keep Wrote:
> 
>> This is just silly.  There's no reason to make this a *language*
>> feature.  I mean, we have templates and mixins for a reason!  To whit:
>>
>> [...]
>>
>> Easy as can be.  You might want to rename the template, though... :3
>>
>> 	-- Daniel
> 
> Not a fan of the whole CTFE craze?
> 

Whatever gives you that impression?  Code I've actually written:

import engine.engine : Engine;
import util.ctfe.ctstrings;
import util.ctfe.string;

// You better believe *this* uses CTFE; it's parsing a damn .ini file!
// It becomes something like `const ROOT_CLASS = "game.foo.Bar";`
mixin ctString!("strings.ini", "ROOT_CLASS");
mixin("static import "~ctfe_module(ROOT_CLASS)~";");

int main(string[] args)
{
    return Engine.main(args, ROOT_CLASS);
}

And that actually worked, too.  Lost interest since rebuild wouldn't
follow the mixined import, tho :3

I just didn't need my evil CTFE powers on this one ;)

	-- Daniel



More information about the Digitalmars-d mailing list