Browse thread
Re: Syntax for label
[
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: | -- (:) |
| From: | Christophe Raffalli <Christophe.Raffalli@u...> |
| Subject: | Re: Syntax for label, NEW PROPOSAL |
Jacques Garrigue wrote:
>
> In this case, I suppose we should read `%' as `is'.
>
> Objective Caml version 2.99+10
>
> # List.map;;
> - : fun%('a -> 'b) -> 'a list -> 'b list = <fun>
> # List.map [1;2;3] fun%succ;;
> - : int list = [2; 3; 4]
> # let sub ?(%pos = 0) ?%len s =
> let len = match len with Some x -> x | None -> String.length s - pos in
> String.sub %pos %len s;;
> val sub : ?pos%int -> ?len%int -> string -> string = <fun>
>
I really do think that it looks better !
You could continue to use ":" in types: because you are giving
information about the type of a label. this would make
# List.map;;
- : fun:('a -> 'b) -> 'a list -> 'b list = <fun>
# List.map [1;2;3] fun%succ;;
- : int list = [2; 3; 4]
# let sub ?(%pos = 0) ?%len s =
let len = match len with Some x -> x | None -> String.length s - pos
in
String.sub %pos %len s;;
val sub : ?pos:int -> ?len:int -> string -> string = <fun>
--
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex
tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI