%u schrieb:
== Quote from so (s...@so.do)'s article
Doesn't this work??

import std.file;
import std.script;

Script s = new Script(cast(ubyte[]) read("script1.d"));
s.compile();
s.execute();
What is this supposed to mean?

This should be a bit more clear (untested code).

--scrip1.d
import std.stdio;
writefln(i);
----

--main.d
import std.file;
import std.script;

void main(){
  Script s = new Script(cast(ubyte[]) read("script1.d"));
  assert(!s.validate);
  int i = 1;
  assert(s.validate);
  s.compile();
  s.execute(); // output 1
}
----

That wouldn't be just a script but a runtime-string-mixin (or something like 
that).
I don't think something like that is feasible in a compiled language.

Reply via email to