メモ
delegate周り。"void delegate() hoge"と書いていたのが"lazy void hoge"になったらしいです。
"lazy void hoge"とか"lazy void hoge"とかは書けなくて、そういう時は"void delegate()[] hoge ..."を使ってくれ、と。
あとメンバ関数にもやっとテンプレートが使えるように!万歳。
import std.c.stdio; struct Foo{ T bar(T)(T t){ return T.init; } } void main(){ Foo f; printf("%d\n", f.bar(5)); }
staticつけるとなんだか怪しい。
import std.c.stdio; struct Foo{ static void hoge(){ printf("hoge\n"); } static T hige(T)(T t){ return t; } template hage(T){ static T huge(T t){ return t; } } } void main(){ Foo f; f.hoge(); // ok Foo.hoge(); // ok f.hige(1); // ok Foo.hige(2); // Error: type Foo is not an expression f.hage!(int).huge(3); // ok Foo.hage!(int).huge(4); // Error: template hage!(int) is not a member of Foo // no property 'huge' for type 'int' // function expected before (), not 1 of type int }
まあどうでもいいんですけどね…いやよくないですね。