Variable number of parameters
Llewellyn Falco
isidore at setgame.com
Tue Dec 6 02:29:37 PST 2011
This is essentially just a form of Currying. I think it's cleaner not
to do the auto-remove missing parameter, but if this was to happen 1-2
times, I would be concerned about the api design.
again, this goes to the question of "do you own the api"
if you own the api then it seems like
interface Bar { void bar(A a, B b)}
foo(Bar bar)
could be extended to
foo(Ba ba) { foo((a,b) -> ba.ba(a));}
with
interface Ba {void ba(A a)}
as there isn't a way to attach methods if you don't own the api, then
this becomes a bit more of a problem.
It is my belief that the desire for this feature "Fantom" is a side
effect of more specific use case of the lack of extension methods.
As it has been decided not to implement extension methods, I think it
would be a mistake to add the "Fantom" feature to fix the single use
case of the more generic solution.
--
Llewellyn Falco
www.approvaltests.com
www.teachingkidsprogramming.org
More information about the lambda-dev
mailing list