Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[OSR] Standard syntax extensions ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-04-27 (06:59)
From: Andrej Bauer <Andrej.Bauer@a...>
Subject: Re: [Caml-list] [OSR] Standard syntax extensions ?
Arthur Chan wrote:
> That
> said, there are some of us who feel that that the python infix syntax is
> clearer, and as it corresponds more directly to the mathematical
> notation, it is just as provably correct as the List.mem notation is. 
> If reusing "in" is a big deal, then maybe we could do "in_list" or
> "inlist"?  That'd be more type-safe too.

Just a small correction, if you will alow me. When we speak of
correctness of a programming language we do not say that "syntax is
provably correct" but rather that the "implementation is correct".

For example, we could say "Ocaml has a correct compiler" in the sense
that type-safe programs don't explode (which is false), or "functional
core of Ocaml has correct operational semantics" with respect to
standard domain-theoretic denotational semantics. But we do not say "the
mem syntax is provably correct".

Actually, the whole phrase "provably correct" is often misused in
computer science, at least the way I understand it. If you prove
something then it is "proved correct", while a thing is "provably
correct" if we _could_ prove it correct. Perhaps a native speaker of
English can clarify this point.

> The python syntax goes further than just the "in" bit, in fact.  They
> can do list comprehensions like [for x in blah if f(x)].  Now every
> functional guru will recognize this immediately as the bastardization of
> List.filter.  While it'd be nice to have that, I come across List.filter
> much less than List.exists/mem.

I rather like the Python comprehension syntax, as well as Haskell's. I
also really like Haskell's infix notation x `op` y.

> Whatever....  it's just a minor quibble, but this thread was about
> syntax extensions, after all.

Isn't everything on this list a minor quibble? ;-)

Best regards,