[m-dev.] Introduce !! rather than ^elem() for indexing
Ralph Becket
rafe at cs.mu.OZ.AU
Wed Oct 10 10:03:42 AEST 2001
Michael Day, Wednesday, 10 October 2001:
> > `A !! I' is syntactically more economical than the current Mercury
> > convention of using `A ^ elem(I)'. However, to make substitution of
> > the form `A !! I := X' parse would require some work.
>
> If you can have A !! I, why not have A ^ I ? Is the !! operator going to
> be specific to lists/arrays/maps and basically replace elem?
No, I think the field access syntax is good (although I have moaned
in the past about the parameter ordering after desugaring...)
I suppose A ^ I could work if one were prepared to allow overloading
of higher order application. While I haven't thought it through,
that idea does set alarm bells ringing: it's reminiscient of the
time I watched someone debug C++ code in which the benighted original
author had seen fit to overload cast to void*.
- 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