When Control Abstraction (maybe) does not fit...
Gernot Neppert
mcnepp02 at googlemail.com
Fri Jan 8 03:56:16 PST 2010
Hello,
what do we do when the syntax for Control Abstraction does not really
fit the API that we're using?
I can see that given a method "<T> void forEach(Collection<T> c, #void(T))",
someone might prefer the Control Abstraction syntax:
forEach(String s: myCollection)
{
System.out.println(s);
}
over the "straightforward" method invocation:
forEach(myCollection, #void(T s) { System.out.println(s); });
But what do think about other usecases that are more old-fashioned
"callback" scenarios, e.g.:
okButton.addActionListener(ActionEvent e:)
{
dialog.hide();
}
Does it look intuitive?
More information about the closures-dev
mailing list