seeding the pot for 2.0 features

Kristian Kilpi kjkilpi at gmail.com
Thu Jan 25 04:00:08 PST 2007


On Wed, 24 Jan 2007 02:09:09 +0200, BCS <ao at pathlink.com> wrote:
[snip]
> my choice: dynamic init structs and explicit context for delegates
>
> int i,j,k;
> // pickle i,j,k then use them
> auto (new struct {int i_ = i; int j_ = j; int k_ = k; }).delegate(int  
> m){return ((i_ * m)+j_)*m +k_;}
>

While we are at it, why not just let the compiler to generate context for  
delegates? ;)
E.g.

   int i, j;
   return int delegete(int m) {return i * m + j;}
->
   return int (new struct {int i_ = i; int j_ = j}).delegete(int m) {return  
i_ * m + j_;}



More information about the Digitalmars-d mailing list