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
Re: [Caml-list] Future of labels
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-04-11 (13:53)
From: fare@q...
Subject: Re: [Caml-list] Future of labels, and ideas for library labelling
>: Jacques Garrigue

> To summarize recent posts by various people, there are two approaches
> for a universal mode:

You left without discussion the approach suggested by Arturo Borquez,
which is quite distinct from that by Chris Hecker:

"An unlabeled argument should be labeled with the first available label
in the declared type of the function being called."

(together with "every function argument declared without label is
given an implicit unique label sui generis"?)

Potential benefits:
* drop-in compatibility with both classic and label mode,
 for those who use consistently use either style.
* allows for continuous change between both styles, depending on what
 one prefers for the function being written.
* works well with fold and higher-order functions and currification.

Potential Problems:
* the order of the labels in the type matters, whereas it didn't,
 which implies compiler changes. I suppose the compiler must currently
 somehow handle order anyway, since even with a possible early canonical
 ordering of labels, you must handle functions that declare a varying
 subset of labels in the global pool.
* it may break either the equivalence between (f x) and (f ~1:x), or the way
 numerical labels do not commute with other labels.
* type declarations that change the order of labels now have some specialness
 in that they modify the meaning of positional parameters. This might be
 something some people would strongly dislike. Or maybe not.
* type inference is made more complex, because of the interaction between
 labelled and unlabelled arguments.

I admit I certainly don't have clear enough an idea of the problems to
judge how doable it is, but if this proposal is doable, it seems to me
that the benefits might be worth it, since it unifies classic and label modes.
In all cases, I'd like to hear about what you think of such proposal,
particularly so if you dismiss it. Let the fact that it was used in some
ancient macroassemblers not make you scorn it.

(I already tried to draw your attention to this approach in the same previous
message when I suggested that a classic mode stdlib could be obtained from
a labelled mode one by writing a camlp4 metaprogram that strips labels and
dumps a wrapper library).

[ François-René DVB Rideau | Reflection&Cybernethics | ]
[  TUNES project for a Free Reflective Computing System  |  ]
The ancients stole all our ideas from us. -- Mark Twain
To unsubscribe, mail  Archives: