Browse thread
(int * int) <> int*int ?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-02-24 (13:40) |
From: | Nicolas Cannasse <ncannasse@m...> |
Subject: | Re: [Caml-list] (int * int) <> int*int ? |
>>>This unfortunate syntax has consequences down to polymorphic variants, >>>which otherwise could be represented more efficiently. >>> >> >>This is interesting, could you explain it shortly? > > > The tuple based syntax for constructors is ambiguous: there is no way > to know syntactically whether a constructor takes as argument a tuple > or separate arguments. This is the reason for this whole discussion. Yes this is not a very big problem but is quite often reported. The reason I see is that (int * int) and int * int are perceived the same because parenthesis are optional when applying the * operator in calculus. In order to fix this, I choose to always have parenthesis for multiple arguments constructors in NekoML : type a { A : int; B : (int , int); // 2 arguments C : ((int , int)); // 1 tuple argument } It is then more easy to understand the difference between B and C, although this is in the end just a matter of using an appropriate syntax. The parenthesis are just abusely used in different manners in most of languages syntax. Nicolas