English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Polymorphic methods and ellipsis
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-24 (08:54)
From: Alessandro Baretta <alex@b...>
Subject: Re: [Caml-list] Polymorphic methods and ellipsis

brogoff@speakeasy.net wrote:
> On Sun, 22 Sep 2002, Alessandro Baretta wrote:
>>Let me suggest another idea where you might better spend 
>>your time. I can write
>> > let f x : 'a -> 'a = x
> Does this do what you think it does? What is the type of f?
> Incidentally, I'd prefer some form of separate, forward type declaration.
> -- Brian

Nope. Right, the colon-type-equals construct is for the 
definition of the return type, as opposed the actual type of 
f. Let me then rework my suggestion as

method f (x:'a) : 'a.'a = x

which is now actually equivalent to

let f (x:'a) : 'a = x


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