Wolfgang Lux wrote:
> Bernd Brassel wrote:
>
>> Francisco Javier López Fraguas wrote:
>>> Consider the program
>> I think the following example is at least curious (Sorry that it is not
>> Toy Syntax):
>>
>> module M1 where
>> data A = A
>>
>> f A = A
>>
>> isF x =
>> case x of
>> f -> True
>> _ -> False
>>
>> test = let x free in isF x=:=False
>>
>> module M2
>> import M1
>>
>> g A = A
>>
>> Now, importing just M1, the expression M1.test fails. Importing M2 also
>> makes it succeed with [x/g]. I think it is curious that you should be
>> able to manipulate the behaviour of modules from the outside like this.
>
> Sorry, but that is wrong. Since you are using a case expression (which
> should remain rigid after introducing partial patterns), the expression
> isF x will simply suspend. So, it does not make a difference whether g
> is in scope or even part of the program or not.
Good point.
However, the concept of extensible data types is in conflict with many
approaches discussed recently:
a) introducing a function (===) equivalent to a flexible version of (==)
which would allow to express (=:=).
x =:= y | x===y = success
b) equivalence between free variables and generator functions, along the
lines of
unknown::Nat
unknown = S unknown
unknown = Z
c) some forms of negation constraints for (=:=)
All of the above concepts would allow to write a function like test and
isF above.
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Mi Apr 11 2007 - 11:56:07 CEST