Function type naming conventions (original) (raw)
Dan Smith daniel.smith at oracle.com
Fri Jan 11 08:24:32 PST 2013
- Previous message: Function type naming conventions
- Next message: Function type naming conventions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Jan 4, 2013, at 3:46 PM, Dan Smith <daniel.smith at oracle.com> wrote:
On Jan 3, 2013, at 2:07 PM, Dan Smith <daniel.smith at oracle.com> wrote:
I'm sure I'll never remember whether IntFunction is int -> int, T -> int, or int -> T, so it'll trip me up a little each time I read it. Stephen Colebourne makes a similar comment in the comments list. His suggestion is to use a different base name for functions that return primitives -- we already have "Predicate" and "Block"; now we just need "IntThingy" and "DoubleThingy". Stephen suggests "CalcInt", which I don't love, but maybe there's a word out there that nicely conveys the concept much like "Predicate"? I did a little Googling: "predicate" is a.k.a. "boolean-valued function". "Real-valued function" and "integer-valued function" are also fairly widely-used terms. But I didn't come across any more concise terms for those...
I've been kicking around an idea in my head for the last few days and haven't rejected it as horrible yet:
"integer-valued function" (and "foo-valued function," generally) is the appropriate, widely-understood term for functions that output integers [1][2][3][4]. So let's just say that, slightly abbreviated:
IntValFunction // T -> int
The meaning should be unambiguous. That leaves "integer function" (and "foo function," generally) to refer to functions that input integers. Again, that general form is widely-understood terminology [5][6].
IntFunction // int -> T
The weak point is that both terms are abused in some contexts (such as [2], I think) to refer to int->int. But since we've got "integer operator" in the mix as well, I think it's fairly straightforward to disambiguate.
—Dan
[1] http://www.proofwiki.org/wiki/Definition:Integer-Valued_Function [2] http://alexandria.tue.nl/repository/freearticles/597509.pdf [3] http://en.wikipedia.org/wiki/Real-valued_function [4] http://en.wikipedia.org/wiki/Boolean-valued_function [5] http://php.net/manual/en/ref.strings.php [6] http://docs.racket-lang.org/reference/pairs.html#3.9.7
- Previous message: Function type naming conventions
- Next message: Function type naming conventions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the lambda-libs-spec-observers mailing list