Re: equality of partial applications

From: Sebastian Fischer <sebf_at_informatik.uni-kiel.de>
Date: Wed, 20 Jun 2012 21:01:01 +0200

>> Yes. For the sake of efficiency, MCC always eta-expands functions as much as it can.
>
> "It's much easier to do compiler optimizations if you don't have to preserve semantics."

Here is a simpler example that shows how MCC's optimizer changes the
results of a program in presence of intensionality:

    cyi> let mkId _ = id in mkId () =:= id
    No solution

Note that 'mkId ()' is not a partial application and equals 'id' by
definition. Without any transformations this example should yield
success iff 'id =:= id' yields success (and it does in PAKCS.) But in
MCC it fails, presumably because 'mkId' is eta-expanded such that
'mkId ()' becomes a partial application different from 'id'.

This bug can be fixed by preventing eta-expansion (even if no
nondeterminism is involved) in the optimizer or by removing the
intensional features embodied by =:=.

Intensionality not only restricts the ability of programmers to reason
about programs but also the ability of compilers to optimize them.

Sebastian
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Do Jun 21 2012 - 16:59:10 CEST

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:12 CEST