C++ functors and boost bind

Neal Gafter neal at gafter.com
Wed Dec 16 08:01:23 PST 2009


In C++, functions and variables are in the same namespace.  That is exactly
one of the approaches we're investigating.  We can't do it generally because
that would break backward compatibility, but since function types are being
newly added to the language, we might be able to say that variables of
function type are in the method namespace in Java.


On Wed, Dec 16, 2009 at 2:49 AM, <diego at trusteagle.com> wrote:

> I may come from a different background, and also don't know the history and
> the full extent of the discussion (e.g.
> http://mail.openjdk.java.net/pipermail/closures-dev/2009-November/000267.html), but I don't fully understand the syntax. I hope somebody will take my
> opinion into account still in this late stage.
> In C++ there is a nicer and more straight forward syntax for callbacks
> available with functors, an example is here:
> http://www.boost.org/doc/libs/1_41_0/libs/bind/bind.html#with_boost_function
> and you can also have
> playButton.onClick(param one,param two)
> with an implementation of
> void operator()(param one , param two)
> in the class button
> At that point you do have a full and extensible object interface and you
> don't need to have extra syntactic sugar.
> This same stuff is used for threads, sockets and ui callbacks.
> Cheers,
> D.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20091216/25fb4b8c/attachment.html 

More information about the closures-dev mailing list