On the richness of C++
Sean Kelly
sean at invisibleduck.org
Tue Apr 15 22:07:48 PDT 2008
== Quote from Walter Bright (newshound1 at digitalmars.com)'s article
> Edward Diener wrote:
> > It is only a big deal in the sense that proving a single callback
> > signature or a single event signature, rather than two of each because
> > of the presumed need to support both delegates and function pointers, is
> > a big deal. In other words it is much cleaner to present a single
> > callable interface in a language, ala boost::function, Python callables,
> > C# delegates etc etc. The callback or event does not care if the
> > callable is a delegate or function pointer as long as the signature
> > matches, so it is a PITA if a language can not fold both into a single
> > callable concept. That is the issue and I think if you think about it
> > you will realize why it is better from both a clarity and ease of use
> > perspective to have a single callable representing both. There is no
> > sense in a language as rich as D to have to move backward from what
> > other other good languages are able to represent.
> There's no reason you cannot write a template in D to do it - Andrei has
> done so in his std.algorithms code.
Sure, but templates don't suit every situation. It's not uncommon for
APIs to have to overload on accepting a function and a delegate for
flexibility.
Sean
More information about the Digitalmars-d
mailing list