Interface and delegate D2.0

oliver oliver.ruebenkoenigREM at web.de
Tue Mar 11 04:41:26 PDT 2008


Neil Vice Wrote:

> Firstly a disclaimer: the following comments are based on D2.012.
> 
> > 1) In the String class is it possible to avoid the use of the "help" 
> > funcntion?
> 
> You can make use of the following syntax:
> 
>     aFn analize()
>     {
>         return delegate Expr (Expr env) { this.print(); return env; }
>     }
> 

that is exactly what i was looking for :-)

> > 2) In the String class: why do I need to cast this to Expr - String is 
> > derived from Expr and should fit - should it not?
> 
> I believe it's because the return type of the inline delegate is determined 
> from your return statement. The syntax to define the return type is in the 
> above example.

OK.
> 
> > 3) Is it possible to avoid the double brackets in Expr.analize()(Expr)? 
> > Something like Expr.analize(Expr)? I assume this could be done with an 
> > alias, are still the other ways? - well eval is another way. I think i am 
> > asking if you see a way to do the same  thing with less brackets.
> 
> I have the same gripe myself and haven't found any work around.
> 

should you find something I'd be very interested. Thanks for you help.

Oliver


More information about the Digitalmars-d-learn mailing list