[mercury-users] maybe(T)

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Oct 21 00:38:08 AEST 2002


On 20-Oct-2002, Michael Day <mikeday at yeslogic.com> wrote:
> 
> :- type maybe(T)
> 	--->	yes(T)
> 	;	no.
> 
> On the C backends, is this type implemented by using a pointer to T to
> represent yes(T) and NULL to represent no?
> If not, is it implemented using an equally efficient strategy?

Yes.  Well, close enough anyway.  We use a pointer to T to represent
yes(T) and we use a pointer with value "1" to represent no.

For the MLDS back-ends, if you use the right compilation options then
we do in fact use exactly the representation that you describe, but
currently this is not the default.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- 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