How to include??
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Sat Oct 20 07:33:22 PDT 2007
Ary Manzana wrote:
> BCS wrote:
>> import is only allowed at module scope, not in a class or function or
>> sutch.
>
> IIRC import is allowed in classes. Also in structs, version, debug, etc.
Apparently it's allowed in function/statements scope too, with a workaround:
template Tpl() { import std.stdio; }
void func() {
mixin Tpl!();
writefln("Foo");
}
void main() {
//writefln("Foo"); // writefln not available
func();
}
Seems it's only disallowed on a syntactic level.
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d-learn
mailing list