Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Suggestion: Pervasives.identity
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin_jambon@e...>
Subject: Re: [Caml-list] Suggestion: Pervasives.identity
On Fri, 23 Apr 2004, Xavier Leroy wrote:

> Even if you define
>         external identity: 'a -> 'a = "%identity"
> references to "identity" will be compiled like "fun x -> x".
> It's only direct applications of "identity", e.g. "identity 3", that
> would be more efficient than with the definition
>         let identity x = x
> But I hope your programs don't contain calls like "identity x"...

My problem was:

(* something.mli *)
type key

(* something.ml *)
type key = int
let key_of_int = identity    (** what should I write here? **)

(* other.ml *)
let key = Something.key_of_int 1


Sure, there are more important problems in the world...


Martin

-------------------
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