Subject: Re: [xsl] Things that make you go Hmmmm!|
From: Michael Sokolov <msokolov@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 29 Mar 2014 14:34:10 -0400
C and C++ certainly allow you to do that, at least to compare pointers to functions. It has some limited meaning. At the very least it allows sorting functions consistently, if somewhat arbitrarily.Functional programming is based on functions as first class values. A function can appear anywhere that any other atomic value can appear. Whether it is on the end of a print statement, as the object of a return statement, as a member of a sequence, in a comparison. You don't stop and say well I don't see what sense it would make for min or gt to compare two functions or a function so I won't allow it.
Strong typing is not incompatible with orthogonal language design. Orthogonality doesn't mean that all operators have to apply to all data values. (Regarding your example, I'm not sure I have come across a language that allows one to ask whether one function is greater than another, and if this operation were offered, I have no idea what it would do.)
Division of functions seems less useful. Certainly a possible, and consistent, rule for applying arithmetic operators such as this to functions is to compose them:
The orthogonality rule that "a function can appear anywhere that an atomic value can appear" is a rule about syntax, not about typing. It doesn't mean that you can divide one function by another.