[m-dev.] 0.13 release: op/3 syntax

Mark Brown mark at cs.mu.OZ.AU
Sat Mar 4 19:26:40 AEDT 2006


On 04-Mar-2006, Peter Schachte <schachte at csse.unimelb.edu.au> wrote:
> Hi Kevin, 
> 
> Great to hear from you!

Likewise.  Rumours of your not dying apparently weren't exaggerated.  :-)

> 
> On Fri, Mar 03, 2006 at 02:32:50PM +0100, Kevin Glynn wrote:
> > Peter Schachte writes:
> >  > Haskell, which doesn't allow its syntax to be extended
> > Hmmmm, that can't be the reason:
> > 
> >   http://www.haskell.org/tutorial/functions.html#sect3.2
> > 
> > In Haskell one can define new infix operators and data constructors
> > without the backtick notation.
> > This is often used to great effect to create Domain Specific Languages
> > which still have access to all of Haskell where necessary. There are
> > many examples: parser libraries, web page generation, hardware design,
> 
> I sit corrected!
> 
> In that case, I revise my argument:  Haskell has user-define
> operators, and they like them.  Mercury should have them, too.

Whoa!  Steady on!  Haskell's infix declarations are used to override the
precedence and associativity of an already existing operator, and they
_don't_ let you make a new operator -- you still have to use backticks to
make an ordinary identifier into an operator.

In other words, Haskell doesn't let you do what you are proposing for
Mercury, but rather it lets you do what we have agreed we don't want.

(The story is that if a name starts with < $ : or whatever, then it is an
operator which by default has highest precedence and no associativity, IIRC.
Otherwise it is a non-operator and will need backticks.)

Concrete syntax is one area where Haskell and Mercury/Prolog are extremely
different, however, so I doubt it's a wise idea to blindly apply the
features of one to the other.

Cheers,
Mark.

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list