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
Same label in different types, how do people solve this?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: Same label in different types, how do people solve this?
> >I understand that all you functional experts thinks this restriction is
> >obvious, but for me it is more like a bug/misfeature. So this 'misfeature'
> >should actually be stated for all us who aren't interested how types are
> >infered in functional programming.

> I'm with Mattias on this one.  I'm practical above theoretical.  All
>of the workarounds for this problem seem like they generate way more
>tedious work for the programmer, and they still don't quite accomplish
>the goal 100%.  This characteristic of doing more work and only
>asymptotically approaching your goal is a bad taste I associate with

> Anyway, my "vote" would be to allow specification, with : if it's
> possible since it's the obvious syntax, but even with @@ if
> necessary (even though I think it's really ugly).
> Chris

I tried a lot of more attractive alternative:
 -- type::label but :: is already used for lists (consing).
 -- type@label, but @ also used (append). 
 -- type`label, but the symbol ` introduces variant
 -- type'label (as in Ada), but ' is used in identifier and chars and ...

Another available notation could be type.:label, or type.'label ...


PS: I added something in the FAQ about the problem of overloading of
labels, see one of (or both :)

Pierre Weis

INRIA, Projet Cristal,,