[mercury-users] record field access syntax

Dave Slutzkin dave_slutzkin at yahoo.com
Sun Jan 6 18:51:42 AEDT 2002


Hi all.

A scrap of code:

:- type test --->
    test(
        one :: int ,
        two :: int
    ).

main -->
    { T = test(1,2) } ,
    { T ^ one := 3 } ,
    print(T ^ one) , nl.

Why do I get this error message?

test2.m:021: Error: expected `Field =^ field1 ^ ... ^
fieldN'
test2.m:021:   or `^ field1 ^ ... ^ fieldN := Field'.
test2.m:021:   in DCG field access goal.

If I'm reading it right, this should work as well:

main -->
    { T = test(1,2) } ,
    { 'one :='(T,3) } ,
    print(T ^ one) , nl.

In this instance I get `undefined predicate 'one
:=/2''.

What am I missing about this lovely syntactic sugar?

Thanks,

Dave.

http://my.yahoo.com.au - My Yahoo!
- It's My Yahoo! Get your own!
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list