How to include??
Ary Manzana
ary at esperanto.org.ar
Thu Oct 18 19:05:37 PDT 2007
The problem is that in a module, class or struct scope (and the rest
where imports are now allowed) you can just put any declaration you
want. This is not the case in a function. For example, you can't declare
a template inside a function.
Humm... And I'm out of examples. Are templates the only declarations not
allwed in a function? Because otherwise, I think it would be possible to
import inside a function or unittest...
Witold Baryluk escribió:
> Dnia Fri, 19 Oct 2007 10:45:27 +0900
> Bill Baxter <dnewsgroup at billbaxter.com> napisał/a:
>
>> Hey, then maybe that's a good workaround for no imports in unittests.
>> Just make a big Test class inside unittest{...} that does all the
>> work.
>>
>> --bb
>
> I also didn't know that import are possible in classes.
>
> unittest {
> class Test {
> import std.stdio
> static test() {
> ...
> }
> }
> Test.test();
> }
>
> hackish :)
>
> Imports in functions and unittest will be also be helpful.
>
More information about the Digitalmars-d-learn
mailing list