equality between functions

Martin Mueller (mmueller@dfki.uni-sb.de)
Mon, 15 Aug 1994 12:04:18 +0200

Date: Mon, 15 Aug 1994 12:04:18 +0200
From: Martin Mueller <mmueller@dfki.uni-sb.de>
Message-Id: <199408151004.MAA02163@godard.dfki.uni-sb.de>
To: caml-list@margaux.inria.fr
Subject: equality between functions

I am just wondering, why CAML light decided to allow for

#let g x = x in g=g;;

to succeed with

-: bool = true

but fail on (eg)

#(function x -> x) = (function x -> x);;
Uncaught exception: Invalid_argument "equal: functional value"

I understand that there are reasons to avoid
equality between functions, but then should not equality and
inequality be handled symmetrically?
For instance, SML/NJ does so and fails on

- let fun g x= x in g=g end;

std_in:0.0-0.0 Error: operator and operand don't agree (equality type required)
operator domain: ''Z * ''Z
operand: ('Y -> 'Y) * ('X -> 'X)
in expression:
= (g,g)

Could someone shed some light onto that issue? I would also
be interested in pointers to the literature on that topic.
Is there a basic reference on equality types?

-- Martin M"uller

---
Martin M"uller,   DFKI,  Stuhlsatzenhausweg 3,  D-66123 Saarbruecken,   Germany
Tel: +49 681 302-5329;   Fax: +49 681 302-5341;    Net: mmueller@dfki.uni-sb.de