[mercury-users] maybe(T)

Michael Day mikeday at yeslogic.com
Mon Oct 21 15:36:08 AEST 2002


> Using `maybe(T)' does have an extra level of indirection compared to using
> plain `T' (just as in C, `T *' has an extra level compared to `T').

Okay, so maybe(int) could be represented as an int pointer in C:

	yes(T)		: valid pointer to an integer
	no		: NULL

However the case I am interested in is when T is a pointer itself already,
for example a string or a structure.

	yes(T)		: pointer to a pointer to something
	no		: NULL

It seems that this could be flattened into this:

	yes(T)		: pointer to something
	no		: NULL

and save an unnecessary pointer cell. Any thoughts?

Michael

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