Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] equality over functional value
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Georges Brun-Cottan <gbruncot@e...>
Subject: [Caml-list] equality over functional value

Hi, 

A friend of mine is just starting with ocaml. He was puzzled by the
following result:

# let a i = i;;
val a : 'a -> 'a = <fun>
# let b i = i;;
val b : 'a -> 'a = <fun>
# a=b;;
Uncaught exception: Invalid_argument "equal: functional value".
# a=a;;
- : bool = true
# 

That is 'a=a' does not return the expected exception.  Actually it
first hit this "curiosity" when creating a polymorphic 'sort' function
on lists - and by applying it to a [sort;sort..] list. It worked.

Is this a bug? 

It might means that some errors can came up detected later than any
Camel rider would have expected...


[Francais]

Bonjour, 

Un ami débute en ocaml. Il fut intrigué par le résultat suivant:

# let a i = i;;
val a : 'a -> 'a = <fun>
# let b i = i;;
val b : 'a -> 'a = <fun>
# a=b;;
Uncaught exception: Invalid_argument "equal: functional value".
# a=a;;
- : bool = true
# 

a=a ne retourne pas l'exception attendue. 

Est-ce un bogue? 

Je suis un peu inquiet à l'idée que certaines erreurs de programmation
grossière peuvent être ainsi être détectés trop tardivement.

-- Georges
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr