Piotr Szturmaj wrote:
final abstract class Console
{
    static:
    void write() { }
    void read() { }
}

Console.write();

P.S. Yes, simultaneous final and abstract actually works :)

Yes, I know there are other ways to do this, like you mentioned above. However, parameter-less templates would still be nice for scopes withing a Class (like my original example). Like I mentioned, it's possible today:

    class Foo
    {
        int bar;

        alias Baz!() baz;
        template Baz()
        {
            int bar;
        }
    }

    auto foo = new Foo();

    foo.bar = 10;
    foo.baz.bar = 10; // Same as..
    foo.Baz!().bar = 10; // ..writing this.

However, like OP is suggesting, it would be nice to have syntax-sugar to eliminate the need for extra typing at instantiation and at definition (my suggestion). The fact that these odd '!()' symbols are required will probably detour less-experienced people from using this feature today.

Reply via email to