Version française
Home     About     Download     Resources     Contact us    
Browse thread
syntax question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: luc.maranget@i...
Subject: Re: [Caml-list] syntax question
> Adam,
> 
> I realize that this is how it works, but I don't understand why it should 
> work this way. AFAIK elsewhere in ocaml "int * int" always refers to a 
> tuple.  Similarly, if testme's Foo really took two int arguments I would 
> expect to be able to create Foos as "Foo 1 2" instead of "Foo (1, 2)" which 

You understanding of constructors is correct : they take n arguments.
Yes, the concrete syntax does not properly reflect the underlying
semantics, with its fake tuple.

Why is this so ? Why ask ? 

In case you are just curious, it can probably be tracked back to the
original Caml where constructors took 0 or 1 arguments, and where
tuples were primitive.

Now, this is so for historical reasons and we live with it.

Alternatives can be considered, best of which probably is the
curried notation. But it is much too late to change that
(but as pointed by others, there is an alternative, "revised", syntax).



> 
> Mike
> 

--Luc