Idea for getting rid of "static" on methods
Matti Niemenmaa
see_signature at for.real.address
Mon Dec 3 04:15:11 PST 2007
Mike wrote:
> This reminds me of this:
>
> http://forums.worsethanfailure.com/forums/thread/82701.aspx
>
> Maybe we could try the same with D :)
class X {
void f()
/+ begin +/
in {} out {} body {}
align abstract auto const debug deprecated export extern final package private
protected public scope synchronized struct {
static union {}
}
override invariant {
asm{}
try volatile with (typeof(super)) switch(typeid(char) is null) { goto default;
case false: }
catch { throw new class {}; } finally {}
delete this;
}
unittest {
for (;;) if (cast(bool)true) {
do continue;
while (function(){});
} else break;
return assert(delegate void(lazy byte, ref cdouble, inout cfloat, creal,
dchar, double, float, idouble, ifloat, ireal, long, real, ubyte, uint, ulong,
ushort, wchar){});
}
}
alias int /+ end +/ x;
83 keywords of a possible 98 (unless I missed some). The code compiles with
-unittest -debug. There's one warning "switch statement has no default" if
compiled with -w, though, so I guess I only get 82 points according to the rules
there. :-)
The class is needed only to get the anonymous struct, otherwise it could be all
at global scope.
Keywords which can't be used at all:
cent, ucent, macro
The rest of the keywords need an identifier and thus can't be used without
breaking the chain. Feel free to prove me wrong, of course. :-)
I chose to use "alias" at the end there because it happened to be alphabetically
the first. The other options:
enum, import, interface, foreach, foreach_reverse, mixin, module
pragma, template, typedef, version, __traits
--
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi
More information about the Digitalmars-d
mailing list