[m-dev.] Why do strings in Mercury need to be word aligned?

Paul Bone pbone at csse.unimelb.edu.au
Thu May 7 17:02:44 AEST 2009


On Thu, May 07, 2009 at 04:47:06PM +1000, Zoltan Somogyi wrote:
> 
> You would lose the ability to some day use a tagged pointer representation
> for a type like this:
> 
> :- type maybe_string
> 	--->	yes(string)
> 	;	no.
> 
> (This is different from instantiating the generic maybe type, which requires
> preserving the ability to handle any values inside yes() polymorphically;
> this type does not require that.)

Julian and I discussed potentially adjusting the type system to support this
optimisation for polymorphic code.  If types are associated with kinds (Julien
called them named kinds) this information could be stored with them.  However
it makes compilation difficult, at the very least libraries such as maybe.m
would have to generate two versions of each procedure for the two different
representations.

Other than my experience with Haskell's kind system my understanding of these
advanced typing topics is very basic.  For more information ask Julien or some
other resources.  (I do have Benjamen Peirce's book on my shelf but I haven't
read much of it).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/developers/attachments/20090507/1212b6e4/attachment.sig>


More information about the developers mailing list