[mercury-users] Feature request: State Variables + Data Terms

obo at ruk.cuni.cz obo at ruk.cuni.cz
Wed Nov 5 04:38:46 AEDT 2003


I've fallen in love with the state variables syntax. But falling in love
with something also means that one often wishes to improve the object...

Would it be hard to allow syntax like this:

:- type my_data ---> data( foo::string, bar::int ).

:- pred update(my_data::in, my_data::out) is det.

update(!Data) :-

...the semantics would be:

update(Data0, Data1) :-
  add_one_to_int(Data0^bar, TInt),
  Data1 = Data0^bar:=TInt.

I do not see any problem in another extra feature, using more than one
part of the dataterm at the same time:

update(!Data) :-
  add_one_to_int_and_trim_a_string(!Data^bar, !Data^foo).

How deep in your todo list would this wish sink?

Thanks, Andrew.

Ondrej Bojar (mailto:obo at cuni.cz)

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