Jonathan Cast wrote:
On Tue, 2007-09-25 at 19:18 +0100, Brian Hulley wrote:
Brian Hulley wrote:
I'm wondering if anyone can shed light on the reason why
x # y
gets desugared to
(#) x y
and not
(#) y x
Of course, this is all a consequence of the well-known failure of
natural language: verbs come before their objects. It is thus natural
to write f(x), when in fact it is the object that should come first, not
the function. Switching to a (natural) language where (finite) verbs
come at the end of sentences, where they belong, should fix this issue
in time. Doing the same in a functional language would be ideal as
well, but might limit its use among those who speak inferior natural
languages.
Thanks, I must look into using postfix notation. It's used in Forth and
Postscript and I seem to dimly recall that there is a natural language
somewhere that also uses it but I can't remember which one.
Not only would it solve the infix/prefix dilemma, but it would also be
consistent with a sugar for an object oriented syntax for application:
a b c f
a .f(b, c)
(Using a dot glued on its right and a left paren glued left to avoid
ambiguity with unglued dot (function composition) and unglued left paren
(unit/tuple/bracketing))
It's not so clear to me what the syntax for types should be in a postfix
language.
Also, a problem might be that it is not so easy to use the
multiple-clause style of function definition eg compare:
map _ [] = []
map f (h : t) = f h : map f t
with
[] f map = []
(h : t) f map = h f : t f map
since the function name is no longer conveniently at the margin of
whatever layout block we are in so extra efforts would need to be made
to line them up, though this is a minor issue.
Thanks again,
Brian.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe