[m-rev.] for review: state vars syntax sugar
Peter Schachte
schachte at csse.unimelb.edu.au
Fri Jan 26 16:57:22 AEDT 2007
Ralph Becket wrote:
> What about running DCGs "backwards"? We might want to do the same with
> state variables.
Touché! And for the X>>dead mode, doesn't X have to be unique?
And there is also an implied mode, and the mostly unique versions.
But they're still pretty orthogonal:
Forward modes: X>>Final, Initial>>X
Backward modes: Initial>>X, X>>Final
For normal versions: Initial=free
For implied versions: Initial=X
Normal: Final=X,
Destructive: Final=dead and X must be unique
Unique: Final=unique and X must be unique
Mostly destructive: Final=mostly_unique and X must be mostly_unique
Mostly unique: Final=mostly_dead and X must be mostly_unique
If that covers all useful cases, how about this for a syntax:
!(X) means X>>X, free>>X
!destructive means unique>>dead, free>>unique
!mostly_destructive means mostly_unique>>mostly_dead, free>>mostly_unique
!input(X) means X>>X, X>>X
!backward(X) means B, A if !(X) means A, B
So most of the time, the mode for a state var would just be !ground, or
occasionally !destructive, which look pretty good to me. Also note that if
Mercury ever supports ui modes, then !unique means (ui, uo).
--
Peter Schachte I worry that 10 or 15 years from now, [my child]
schachte at cs.mu.OZ.AU will come to me and say 'Daddy, where were you
www.cs.mu.oz.au/~schachte/ when they took freedom of the press away from
Phone: +61 3 8344 1338 the Internet?' -- Mike Godwin
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list