Related articles |
---|
[3 earlier articles] |
Re: Definable operators (was: Problems with Hardware, Languages, and C rrogers@cs.washington.edu (1997-03-13) |
Re: Definable operators (was: Problems with Hardware, Languages, and C creedy@mitretek.org (1997-03-14) |
Re: Definable operators (was: Problems with Hardware, Languages, and C nmm1@cus.cam.ac.uk (1997-03-16) |
Re: Definable operators (was: Problems with Hardware, Languages, and C andy@cs.Stanford.EDU (1997-03-16) |
Re: Definable operators (was: Problems with Hardware, Languages, and C malcolm@sedi8.nag.co.uk (1997-03-16) |
Re: Definable operators (was: Problems with Hardware, Languages, and C apardon@rc4.vub.ac.be (1997-03-18) |
Re: Definable operators (was: Problems with Hardware, Languages, and C jenglish@crl.com (1997-03-18) |
Re: Definable operators (was: Problems with Hardware, Languages, and C nmm1@cus.cam.ac.uk (1997-03-21) |
From: | jenglish@crl.com (Joe English) |
Newsgroups: | comp.compilers,comp.lang.misc |
Date: | 18 Mar 1997 12:59:26 -0500 |
Organization: | Tagheads |
References: | 97-03-037 97-03-043 97-03-047 97-03-070 |
Keywords: | design |
Nick Maclaren <nmm1@cus.cam.ac.uk> wrote:
>> [ re: user-defined infix operators ]
>
>Algol 68 did, and was by no means the first. But Haskell has made a
>very old mistake in being too general - consider the problems about
>parsing a mixture of left- and right-associative operators of the same
>priority.
Haskell treats this condition (correctly, IMO) as a parse error. (I
think ML does the same thing).
> Even worse, consider varying commutativity and distributivity.
Distributivity and commutativity are semantic properties, not
syntactic ones; I don't see why this should affect parsing. Haskell
does allow you to specify an operator as non-associative -- so that (X
`op` Y `op` Z) will be flagged as an error without further
parenthesization -- which is sometimes useful for operators that
aren't commutative.
> The 1960s experience was that allowing user- defined operators
> (including redefinition) was fine, as was allowing user-defined
> precedences for textually new ones, but beyond that lies madness.
I think the 1990s experience has been somewhat different :-) Judicious
use of user-defined infix operators has been very beneficial to
clarity of exposition in most of the Haskell code I've written and
read.
--Joe English
jenglish@crl.com
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.