Version française
Home     About     Download     Resources     Contact us    
Browse thread
Custom operators in the revised syntax
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] Custom operators in the revised syntax
On 5/11/07, brogoff <brogoff@speakeasy.net> wrote:
> On Fri, 11 May 2007, Nicolas Pouillard wrote:
> > On 5/11/07, brogoff <brogoff@speakeasy.net> wrote:
> > > Any chance we could have something like in Haskell where you easily
> > > define new infix names?
> >
> > Something general like: x `foo` y ?
>
> Exactly.

Fine, but what syntax? The backquote is already use for polymorphic
variants (and in stream parsers too).

>
> > In Haskell you can put brackets and semi-colons if you dislike
> > significant layout.
>
> Yes, I know. I don't dislike significant layout, I'm just pointing out
> that the (relatively minor) issues I have with OCaml syntax, like
> try/with or if/then capturing more than I expect, are fixed in Revised,
> by using more brackets.

Personally I would prefer just an "end" to close them.
That's what I've done in a small *experimental* extension called
Reloaded. It's usable on top of the original syntax or the revised
one.

camlp4o -parser rr -str "match x with A -> 1 | B -> 2 end"

-- 
Nicolas Pouillard