How is the D programming language financed?
Mafi
mafi at example.org
Fri Dec 24 04:28:48 PST 2010
Am 24.12.2010 10:41, schrieb spir:
> On Thu, 23 Dec 2010 23:18:06 -0600
> Andrei Alexandrescu<SeeWebsiteForEmail at erdani.org> wrote:
>
>>> module testmodule;
>>>
>>> import std.string : split;
>>> import std.stdio : writeln;
>>>
>>> string modulename = split(.stringof)[1];
>>>
>>> void main()
>>> {
>>> writeln(modulename);
>>> }
>>
>> What the... I didn't know you can do that. Thanks for the tip!
>
> What is this syntactic form (".something")? Is there an explicit alternative, with a prefix?
>
> Denis
> -- -- -- -- -- -- --
> vit esse estrany ☣
>
> spir.wikidot.com
>
A leading dot means looking up at the module's scope. An explicit prefix
would be the module name but then you're back at hardcoding the
modulename. And stringof is a special property of everything (I think)
which gives you a compile-time string out of it.
Mafi
More information about the Digitalmars-d
mailing list