DUAL FEATURE REQUEST: let "with" take a struct pointer and evaluate to its parameter
downs
default_357-line at yahoo.de
Sat Dec 22 11:15:46 PST 2007
Daniel Keep wrote:
> Consistency demands that 'foo' only exists until the end of the while
> block. What, then, would be the point of giving the struct a name for
> the duration of a construct whose primary purpose is to allow you to
> omit the name?
>
For what it's worth, I actually intended to do that.
Consider:
>
> R delegate() bind(R, T...)(R delegate(T) dg, T bind) {
> struct Holder { typeof(dg) _dg; T _bind; R call() { return _dg(_bind); } }
> with (new holder) {
> _dg=dg;
> _bind=bind;
> return &call;
> }
> }
Luckily D 2.0 will make this unnecessary :)
--downs
More information about the Digitalmars-d
mailing list