[mercury-users] Typeclass constraint on HO (function) discriminator

Ralph Becket rafe at cs.mu.OZ.AU
Thu Apr 20 22:47:01 AEST 2006


Nicholas Nethercote, Thursday, 20 April 2006:
> On Thu, 20 Apr 2006, Ralph Becket wrote:
> >It's an abuse of the notation: DCGs are for parsing.
> 
> Says who?  It's his code and it works.  Looks like a style issue to me.

If you use DCG notation then the term [a, b, c] is a valid goal, but it
will not unify with an IO state.  Plus, all interpretations of DCGs are
as parsing devices.  The fact that an extra state pair is threaded
through is a kind of accident that works for IO in Mercury.  You're
right, it is a style issue, and having discussed this years ago, we
decided the best course was to adopt state variables for IO and reserve
DCGs for parsing.  Of course, you can always break the convention, but
it won't win you any friends amongst people that have to read/maintain/
debug your code.

--------------------------------------------------------------------------
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