caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Overlapping features of variant types and tuples in Ocaml
@ 2002-05-16 17:04 Vesa Karvonen
  2002-05-16 19:17 ` Daniel de Rauglaudre
  0 siblings, 1 reply; 7+ messages in thread
From: Vesa Karvonen @ 2002-05-16 17:04 UTC (permalink / raw)
  To: caml-list

Consider the following code:

  type variant =
    | Tuple of (int * int)
    | Non_tuple of int * int

  let contents variant =
    match variant with
      | Tuple x ->
          x
      | Non_tuple x ->
          x

As you can tell, the above code does not compile with Ocaml 3.04:

  The constructor Non_tuple expects 2 argument(s),
  but is here applied to 1 argument(s)

Is there a good reason for this behaviour or would it be purely
beneficial to remove the special handling of type lists in variants?


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Overlapping features of variant types and tuples in Ocaml
  2002-05-16 17:04 [Caml-list] Overlapping features of variant types and tuples in Ocaml Vesa Karvonen
@ 2002-05-16 19:17 ` Daniel de Rauglaudre
  2002-05-17  8:17   ` Marc Pantel
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel de Rauglaudre @ 2002-05-16 19:17 UTC (permalink / raw)
  To: caml-list

On Thu, May 16, 2002 at 08:04:18PM +0300, Vesa Karvonen wrote:

>   The constructor Non_tuple expects 2 argument(s),
>   but is here applied to 1 argument(s)

This is resolved by fixing the syntax of OCaml. But improving the
syntax is supposed to be a loss of time by a lot of people.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Overlapping features of variant types and tuples in Ocaml
  2002-05-16 19:17 ` Daniel de Rauglaudre
@ 2002-05-17  8:17   ` Marc Pantel
  0 siblings, 0 replies; 7+ messages in thread
From: Marc Pantel @ 2002-05-17  8:17 UTC (permalink / raw)
  To: Daniel de Rauglaudre; +Cc: caml-list

Hi,

My purpose is not to start another flame war... I only want to give a 
point of view shared by many at work. And support the interesting work
done with CaMLP4.


> This is resolved by fixing the syntax of OCaml. But improving the
> syntax is supposed to be a loss of time by a lot of people.

Improving the syntax is certainly not a loss of time when the syntax is
EXTREMELY ambiguous... We are using CaML as the initial language in our
programming courses at our computer science engineering school ENSEEIHT
and students lose a lot of time introducing parenthesis en order to lift
the ambiguities in many constructs. 


As far as I know, the main use of CaML in France is teaching. Therefore,
improving its syntax is EXTREMELY important.

Also, if we want CaML to be used in Quality-certified industrial
context, we would be much more convincing with a less ambiguous syntax.

However, if the sole purpose of CaML is to develop research software,
I've been using it for years and I do not fall any more in the
ambiguities, therefore let's keep it this way.

If we want to develop its use in other contexts, let's improve its
syntax a bit in order to throw away ambiguities...


I also happen to teach compiler courses (therefore grammar design)...
One of the point we stress is non-ambiguous grammar. We've got a small
experience in purpose specific language design and we are now convinced
that LL(k) constraints ensures easy to read and to write programs...
Even, if the grammars are more complicated. We think that a language
should have a LL(k) grammar event if we use LR(k) tools that allows
left-recursive grammars.


No flame, please. However, all critics are welcomed.

Sorry for the poor english...

Let's not lose too much energy fighting over each others work...
Everything is interesting if it eases the use of CaML in other contexts.

Marc Pantel,
Associate-Professor in Computer Science,
ENSEEIHT, TOULOUSE, FRANCE
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Overlapping features of variant types and tuples in Ocaml
  2002-05-16 19:57 ` Daniel de Rauglaudre
@ 2002-05-17 11:40   ` Luc Maranget
  0 siblings, 0 replies; 7+ messages in thread
From: Luc Maranget @ 2002-05-17 11:40 UTC (permalink / raw)
  To: Daniel de Rauglaudre; +Cc: caml-list

> 
> Hi,
> 
> On Thu, May 16, 2002 at 10:45:44PM +0300, Vesa Karvonen wrote:
> 
> > I'm not quite sure what you mean. Do you mean that improving the
> > syntax is perceived to be waste of time by many people.
> 
> Right. Notice that your question is frequently asked. Your problem
> could be resolved syntactically (I mean by changing the syntax). See
> Camlp4 and its "revised syntax", section "types".
> 
> -- 

I personnaly like Daniel's solution to the
1 pair argument/2 arguments constructor dilema.
[C (e1, e2) <-> C e1 e2, as it was for instance the case in lml, the
lazy ml compiler from Goteborg]


But changing such a basic feature of caml is a real problem (backward
compatibility). So I can live with the old syntax.


To me, the most annoying point with the ``official'' syntax of constructors is
that beginners get confused.  Then, as you get more familiar with a
language, you get used to its syntax, and such trouble dissapears.
I admit that this way of seeing things may lead me to consider syntax
problems as of ``minor importance'' this does not mean that syntax is
a non-issue and that working on syntax is wasting time.

The key point is that the old syntax does not reflect well that
constructors have n arguments.



Shipping camlp4 with the distribution is a good idea.
That way, Daniel's improvements (hum, I do not agree with all parts of
revised syntax...) are easily available, better integrated, and
considered officially as part of ocaml.
For example our team choosed to use camlp4 in the new version of jocaml
(under developpement), and the presence of camlp4 inside the
distribution is very convenient.


--Luc
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Overlapping features of variant types and tuples in Ocaml
@ 2002-05-16 22:02 Vesa Karvonen
  0 siblings, 0 replies; 7+ messages in thread
From: Vesa Karvonen @ 2002-05-16 22:02 UTC (permalink / raw)
  To: caml-list

From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
>On Thu, May 16, 2002 at 10:45:44PM +0300, Vesa Karvonen wrote:
>
> > I'm not quite sure what you mean. Do you mean that improving the
> > syntax is perceived to be waste of time by many people.
>
>Right. Notice that your question is frequently asked. Your problem
>could be resolved syntactically (I mean by changing the syntax). See
>Camlp4 and its "revised syntax", section "types".

Thanks, I understand now that this issue has turned political and
technical arguments no longer have any value. I won't waste any more
of my time on this issue.


_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Overlapping features of variant types and tuples in Ocaml
  2002-05-16 19:45 Vesa Karvonen
@ 2002-05-16 19:57 ` Daniel de Rauglaudre
  2002-05-17 11:40   ` Luc Maranget
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel de Rauglaudre @ 2002-05-16 19:57 UTC (permalink / raw)
  To: caml-list

Hi,

On Thu, May 16, 2002 at 10:45:44PM +0300, Vesa Karvonen wrote:

> I'm not quite sure what you mean. Do you mean that improving the
> syntax is perceived to be waste of time by many people.

Right. Notice that your question is frequently asked. Your problem
could be resolved syntactically (I mean by changing the syntax). See
Camlp4 and its "revised syntax", section "types".

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Overlapping features of variant types and tuples in Ocaml
@ 2002-05-16 19:45 Vesa Karvonen
  2002-05-16 19:57 ` Daniel de Rauglaudre
  0 siblings, 1 reply; 7+ messages in thread
From: Vesa Karvonen @ 2002-05-16 19:45 UTC (permalink / raw)
  To: caml-list

Daniel de Rauglaudre:
>On Thu, May 16, 2002 at 08:04:18PM +0300, Vesa Karvonen wrote:
> >   The constructor Non_tuple expects 2 argument(s),
> >   but is here applied to 1 argument(s)
>This is resolved by fixing the syntax of OCaml. But improving the
>syntax is supposed to be a loss of time by a lot of people.

I'm not quite sure what you mean. Do you mean that improving the
syntax is perceived to be waste of time by many people, or do you
mean that improving the syntax would waste the time of many people
(or both)?

I would estimate that it would take less than 30 minutes from a
capable Ocaml developer to change and test this issue by
modifying the Ocaml parser. After changing the syntax, it should
be possible to simplify the handling of variant types in the
compiler.


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-05-17 11:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-16 17:04 [Caml-list] Overlapping features of variant types and tuples in Ocaml Vesa Karvonen
2002-05-16 19:17 ` Daniel de Rauglaudre
2002-05-17  8:17   ` Marc Pantel
2002-05-16 19:45 Vesa Karvonen
2002-05-16 19:57 ` Daniel de Rauglaudre
2002-05-17 11:40   ` Luc Maranget
2002-05-16 22:02 Vesa Karvonen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).