Function parameter order

Tim Peierls tim at peierls.net
Wed Nov 7 09:32:01 PST 2012


On Wed, Nov 7, 2012 at 12:18 PM, Raab, Donald <Donald.Raab at gs.com> wrote:

> Here is a test I wrote that shows all of the useful combinations I can
> think of in a few hours time (there are more of course).  It should show
> how these things will look better than me trying to use some formal
> specification.  I know some folks hate numeric arity, but I think it is a
> form of useful compression (how many Objects are in
> ObjectObjectObjectObjectObject or TTTTT vs. just saying Object5 or T5).  If
> you don't like "T" here please replace it with "Object" or your favorite
> generified type name.
>

Numbers are fine here. T isn't terrible. What about just "Type"?



> I've included 3 tests below.  One for Procedure, Function and IntFunction.
>  Predicate will be like Procedure (only one class) so I didn't include it,
> although technically, it could be handled with a BooleanFunction.  I prefer
> Predicate, but I wonder whether both BooleanFunction and Predicate are
> useful.
>

It's important to have Predicate. Question is whether there's any use for
BooleanFunction other than completeness.




> I will assume if you can't reason about it without asking lots of
> questions, then it is not a good proposal.


I got it reasonably quickly, so I think it's a reasonable proposal.



> Return type is the last parameter in the list of generic types in the case
> of Function, so hopefully that explains one little thing that might be hard
> to figure out with all Strings in the examples.
>

I could live with this but would find it easier to read if there were
little words to delimit and clarify things for casual readers, e.g.,
Function.OfType2ToInt.

--tim


More information about the lambda-libs-spec-observers mailing list