[mercury-users] Suggestion: new operator

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Oct 20 13:56:57 AEDT 2000


On 19-Oct-2000, Ralph Becket <rbeck at microsoft.com> wrote:
> We now have a selection of infix operators for common tasks (`^' for 
> field access, `++' for concatenation etc.)  I propose adding `@' as a
> synonym for `lookup' operations:
> 
> Map @ Key     <=> map__lookup(Map, Key)
> String @ Idx  <=> string__unsafe_index(String, Idx)
> Array @ Idx   <=> array__lookup(Array, Idx)
> etc.

Well, it would certainly be a bad idea to use `@' for string__unsafe_index.
It should be `string__index_det'; if you want the unchecked version,
then you should have to ask for it explicitly.

Note that right now you can write

	Map `lookup` Key
	String `index_det` Key
	Array `lookup` Key

if you want.  But I'd be quite happy to have `@' as a synonym.

BTW, on a related note, I'd like to keep one character (and '$' is the
only one left) reserved for use by pre-processors.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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