VBやJSを使ってた人から見れば
import std.stdio; void main(){ writefln(22.toString()); }
が通らないのに違和感があるはず。ってより未だに違和感が取れない俺ガイル。
この場合22.の.は小数点として扱われてしまう…んだけどこの仕様はどうなんだろう。まぁ22の後にスペース入れれば取り合えず構文エラーにはならない。
後はこのパッチを当てるだけ。
diff -u8 dmd.176/expression.c dmd/expression.c --- dmd.176/expression.c 2006-12-03 15:07:50.000000000 +0900 +++ dmd/expression.c 2006-12-07 15:42:42.000000000 +0900 @@ -4678,18 +4678,19 @@ if (e1->op == TOKdot) { // BUG: we should handle array.a.b.c.e(args) too DotIdExp *dotid = (DotIdExp *)(e1); dotid->e1 = dotid->e1->semantic(sc); assert(dotid->e1); if (dotid->e1->type) - { - TY e1ty = dotid->e1->type->toBasetype()->ty; + { + Type *e1type = dotid->e1->type->toBasetype(); + TY e1ty = e1type->ty; if (e1ty == Taarray && dotid->ident == Id::remove) { if (!arguments || arguments->dim != 1) { error("expected key as argument to aa.remove()"); goto Lagain; } Expression *key = (Expression *)arguments->data[0]; key = key->semantic(sc); @@ -4697,17 +4698,18 @@ key->rvalue(); TypeAArray *taa = (TypeAArray *)dotid->e1->type->toBasetype(); key = key->implicitCastTo(sc, taa->index); key = key->implicitCastTo(sc, taa->key); return new RemoveExp(loc, dotid->e1, key); } - else if (e1ty == Tarray || e1ty == Tsarray || e1ty == Taarray) + else if (e1ty == Tarray || e1ty == Tsarray || e1ty == Taarray || + (e1type->isTypeBasic() && e1ty != Tvoid) || e1ty == Tenum ) { if (!arguments) arguments = new Expressions(); arguments->shift(dotid->e1); e1 = new IdentifierExp(dotid->loc, dotid->ident); } } }