Implicit instantiation of parameterless templates
Maxim Fomin
maxim at maxim-fomin.ru
Fri Oct 5 13:30:12 PDT 2012
On Friday, 5 October 2012 at 20:19:26 UTC, Piotr Szturmaj wrote:
> F i L wrote:
>> Dmitry Olshansky wrote:
>>> Hm... If placed at the global scope it looks like a namespace.
>>
>> I don't see anything wrong with that. It's just another way
>> (somewhat
>> unique to D) you can categorize your code. Most people
>> probably won't
>> use this sort of thing all over the place, but it actually
>> might be
>> useful for "enforcing" naming classifications:
>>
>> // File system/io.d
>>
>> template Console
>> {
>> void write( ... )
>> void read()
>> }
>
> final abstract class Console
> {
> static:
> void write() { }
> void read() { }
> }
>
> Console.write();
>
> P.S. Yes, simultaneous final and abstract actually works :)
Thanks to how dmd parses code, many simultaneous things actually
work, sometimes it is nonsense http://dpaste.dzfl.pl/04e6bf33
More information about the Digitalmars-d
mailing list