[m-dev.] State variable syntax - last call for opinions

Ralph Becket rafe at cs.mu.OZ.AU
Thu Jan 31 12:44:43 AEDT 2002


Peter Schachte, Thursday, 31 January 2002:
> On Wed, Jan 30, 2002 at 05:57:15PM +1100, Ralph Becket wrote:
> > 
> > Personally I don't find this any more attractive than the other options
> > (3 would be my choice.)  The drawback is that !!X is going to be the
> > common case while !X and !:X will be used only occasionally.
> 
> Actually, I deliberately made the operator to be used in goals and
> clause heads visually denser to make it stand out more.  I'm concerned
> that in a goal like
> 
>     foobar(Something, big_term(1,2,3), Anothervar, !Thread, Output)
> 
> the single ! is hard to see, and it would be easy to see that as a
> call to foobar/5.  I don't even think !! is enough.

Well, this is a moot point.  The lightweight syntax !X representing a
pair of arguments is the one thing everybody (else) has managed to agree
on!  I think the single ! is sufficiently clear - you could always train
your syntax highlighting editor of choice to emphasise it...

> Also, a few nitty detail questions.  In any clause containing !Foo,
> would an unadorned Foo be an error?  I think it should.  Permitting it
> would be not only giving users enough rope to hang themselves, it
> would be wrapping it around their necks and tying it to the rafters as
> well.

While I'm not sure that it's tantamount to lynching the programmer, I
agree that it should be an error.  I'll be sure to check for it...

> (Using my notation above) is referring to !X before the first !:X an
> error?  Again, I think it should be.

Not if !.X appears in the head of the clause.

> For a clause without !:X (or !!X) in the head, if the last atom
> mentioning X has !:X in it, does this give a singleton warning?  I
> believe it should, since your binding a variable not used elsewhere in
> the clause.

There's no connection between modes and !.X and !:X - it would just be a
convention of interpretation that !.X denotes an input and !:X an
output.

> Is it an error to have multiple !:X in the same atom?  I think it
> probably should be.  You could give it a sensible meaning, but I think
> it would be too confusing to use.

I'd rather stick with a simple, general transformation and let the
programmer learn to avoid baroque coding styles the hard way.

- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list