[mercury-users] some [T] ...
Michael Day
mikeday at yeslogic.com
Sun Nov 17 21:13:46 AEDT 2002
Hi,
For the following type:
:- type foo ---> some [T] foo(T) => bar(T).
How will it be represented by the compiler? If not for the existential
quantifier, presumably it would be a no-tag type. However does the
existential quantifier mean that values of type foo are represented by a
pointer to a cell containing two further pointers, one to the T and one to
the type info for T? Does the fact that there is a type class constraint
on T affect the storage in any way, for example by requiring an additional
pointer to the type class method dictionary? Or is this referenced from
the type info?
In this case, I am really looking for a value of a simple type (foo) and a
simple inst (ground) that I can pass around that actually encapsulates a
predicate via the type class methods. In some cases, this seems much more
convenient than passing around a pred(...) and having to get all the modes
right, which is basically impossible with the current compiler / library.
However given that T will in many cases be a unit type carrying no
information, it would be a shame to take three pointers when one would do.
Any tips?
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