So I finally got my buggy email editor to work
and was wondering if there has to be any particular ordering to the alias
declarations that you can use within a scope? How and when is the lookup
done? Does lexical order matter?
For that matter, does it matter about lexical
order of local variable declarations? I don't see why it should, except
an initialization might be easily taken out of order in presence of prior
assignments.
Sean
From the Digital Mars website:
Alias Declarations
A symbol can be declared as an alias of
another symbol. For example: import string;
alias string.strlen mylen;
...
int len = mylen("hello"); // actually calls string.strlen()
The following alias declarations are valid: template Foo2(T) { alias T t; }
instance Foo2(int) t1; // a TemplateAliasDeclaration
alias instance Foo2(int).t t2;
alias t1.t t3;
alias t2 t4;
alias instance Foo2(int) t5;
t1.t v1; // v1 is type int
t2 v2; // v2 is type int
t3 v3; // v3 is type int
t4 v4; // v4 is type int
t5.t v5; // v5 is type int
Aliased symbols are useful as a shorthand for a long qualified symbol
name, or as a way to redirect references from one symbol to another: version (Win32)
{
alias win32.foo myfoo;
}
version (linux)
{
alias linux.bar myfoo;
}
Note: Type aliases can sometimes look indistinguishable from
alias declarations: alias foo.bar abc; // is it a type or a symbol?
The distinction is made in the semantic analysis pass.
Copyright (c) 1999-2002 by Digital Mars, All Rights
Reserved
> Implemented new alias
declarations.
>
> www.digitalmars.com/d/declaration.html
>
> ftp://ftp.digitalmars.com/dmdalpha.zip
>
>
>
>