Version franaise
Home About Download Resources Contact us
Browse thread
Equality of functional values
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stefan Monnier <monnier@i...>
Subject: Re: Equality of functional values
> I really meant 'Intensional equality', in other words, if they are the same
> as far as the system is concerned (in a logic this usually this means the
> same syntactically, but in the case of ocaml that would be pointer
> equality).

I don't know what the OCaml optimizer may do, but I do know that in SML/NJ
such an intentional equality would often not give the expected result,
because it's pretty common for it to use various forms of eta-like
expansions in the hope of doing uncurrying or argument flattening, so you
may end up with

   f == f

turned into

   (λx1.λx2.f(x1,x2)) == (λy1.λy2.f(y1,y2))

and the system may not try to recognize that the two lambda-expressions are
identical (too costly an analysis for no performance benefit), so it will
compile them to two different pieces of machine language.


        Stefan