dmd 2.029 release

tama repeatedly at gmail.com
Mon Apr 20 03:19:43 PDT 2009


On Mon, 20 Apr 2009 18:12:16 +0900, Walter Bright  
<newshound1 at digitalmars.com> wrote:

> bearophile wrote:
>> BCS Wrote:
>>> Cool template function literals sounds interesting
>>  May I have one example of them?
>> I am looking in the docs, but I am not finding anything...
>
> void foo(alias f)()
> {
>      f(3, 4);
> }
>
> foo!((x,y){return x * y;))();

void foo(alias f)()
{
     writefln(f(3, 4));
}
foo!((x,y){ return x * y; })();

This code doesn't work(compile error). But, following code works.

void bar(alias f)()
{
     writefln(f("bar"));
}
bar!((str) { return str; })();

Is this a bug?

-- 
tama <repeatedly at gmail.com>
http://profile.livedoor.com/repeatedly/
メンバー募集中
http://tpf.techtalk.jp/


More information about the Digitalmars-d-announce mailing list