On Sun, May 10, 2009 at 3:59 PM, Robert Fischer <[email protected]> wrote: > > When I say "argument typing", I meant having a single "function" class and > leaving the number of > arguments to being an implementation detail handled by the type of the > argument class. The reason > is because function classes usually do some fairly heavy lifting which > shouldn't be repeated for the > N number of functions.
Ah, I see. No, this function class doesn't expose anything except the ability to apply one of its members to an argument list. Trivial. I'm not even sure I'm going to need need more than one class. There are three plausible interfaces to each function: direct call (known function, no need for a Function object), funcall (unknown function applied to a known number of arguments), and apply (unknown function applied to an unknown number of arguments). It's trivial to do funcall in terms of apply, but it does mean constructing and destructing the argument list. On the other hand, providing three interfaces instead of two means extra complexity and error recovery. So I may just go with a single Function class providing only an apply interface. > > ~~ Robert. > > John Cowan wrote: >> On Sat, May 9, 2009 at 11:06 AM, Robert Fischer >> <[email protected]> wrote: >>> John Cowan wrote: >>>>> Depending on your schema of call types, you'll want to choose between >>>>> grouping call types on interface types vs. one call type per interface >>>>> type. >>>> Since the arguments and returns are all Object, I think all I need is >>>> one class per arity: Function0, Function1, Function2, ... FunctionN, >>>> which last takes an Object[] of arguments. >>>> >>> I'd recommend having a Function<ARG_T extends ArgumentType> and abstract >>> away the argument typing. >> >> The language is dynamically typed, so Object really is all there is. >> >>> ~~ Robert Fischer. >>> Grails Training http://GroovyMag.com/training >>> Smokejumper Consulting http://SmokejumperIT.com >>> Enfranchised Mind Blog http://EnfranchisedMind.com/blog >>> >>> Check out my book, "Grails Persistence with GORM and GSQL"! >>> http://www.smokejumperit.com/redirect.html >>> >> >> >> > > -- > ~~ Robert Fischer. > Grails Training http://GroovyMag.com/training > Smokejumper Consulting http://SmokejumperIT.com > Enfranchised Mind Blog http://EnfranchisedMind.com/blog > > Check out my book, "Grails Persistence with GORM and GSQL"! > http://www.smokejumperit.com/redirect.html > > > > -- GMail doesn't have rotating .sigs, but you can see mine at http://www.ccil.org/~cowan/signatures --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---
