rationale for function and delegate

Paulo Pinto pjmlp at progtools.org
Sat Oct 16 01:40:55 PDT 2010


Hi,

while reading TDPL I start wondering what is the background between function 
and delegate.

They seem to provide more or less the same funcionality, except delegate 
allows the capture
of the function declaration environment.

Most of the programming languages with support for closures only have one 
way of doing it.

Why is D providing two ways of doing it? For me sounds like a feature 
similar to register, or
inline for doing what should be the compilers work. Deciding the best 
implementation for the
closure.

Thanks,
Paulo 




More information about the Digitalmars-d mailing list