Am 30.04.2012 08:22, schrieb Jacob Carlborg:
On 2012-04-29 20:29, Sönke Ludwig wrote:

You just don't have to care about how to parse command line arguments,
how to initialize the library and to start the event loop.

Right, didn't thought of that. Would it be a good idea to allow top
level code and use "import" and mixin the code in some context, i.e. :

// foo.d

auto settings = new HttpServerSettings;
settings.port = 8080;
listenHttp(settings, &handleRequest);

Then somewhere:

// vibe.d

void main (string[] args)
{
handleCommandLine(args);
init();
mixin(import("foo.d"));
}


Interesting haven't thought about going that far :)

Somehow that reminds me of:
#define IF if(
#define THEN ){
#define ELSE } else {
#define ENDIF }

to transform C into BASIC. The scripting-only people would probably be thrilled ;) But I have the tendency to think that this bends the language a bit too far. They will also soon wonder why they cannot put top-level code in their other files.

Sönke

Reply via email to