[mercury-users] Inconsistency of fields and functions

Michael Day mikeday at yeslogic.com
Mon Jul 24 11:28:22 AEST 2006


If you have a non-abstract type with fields like this:

    :- type foo
        --->    foo(value :: fruit).

The compiler will happily accept this switch as being deterministic:

    (
        Foo ^ value = orange
    ;
        Foo ^ value = apple
    )

However if the type is made abstract, and the field access is exported by
adding this function declaration:

    :- func foo ^ value = fruit.

then the compiler will no longer recognise the switch as being
deterministic, even though it clearly still is, as the function is not
impure. It's a minor but irritating inconsistency :)

Michael

-- 
Print XML with Prince!
http://www.princexml.com
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at csse.unimelb.edu.au
administrative address: owner-mercury-users at csse.unimelb.edu.au
unsubscribe: Address: mercury-users-request at csse.unimelb.edu.au Message: unsubscribe
subscribe:   Address: mercury-users-request at csse.unimelb.edu.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list