Re: [MLton] Changing MLton.Pointer.word

Christopher Cramer <[email protected]> Mon, 23 Jun 2014 10:24:55 -0400
Newsgroups gmane.comp.lang.ml.mlton.devel
Message-ID <[email protected]>
On Mon, Jun 23, 2014 at 08:03:23AM +0200, Florian Weimer wrote:
> I would like to change MLton.Pointer.word to Word32.word on 32-bit
> architectures, and Word64.word on 64-bit architectures.

If you need a word the size of a pointer, it's actually already available
in the C_Pointer structure, made available in $(SML_LIB)/basis/c-types.mlb.
See http://mlton.org/ForeignFunctionInterfaceTypes.

> What's the best way to implement this?  Compiler hacking with primitives?
> Changing MLB files?  Some form of preprocessing?

The easiest way to do it would be to just include that c-types.mlb
in basis-library/build/sources.mlb, and put "type word = C_Pointer.word"
in basis-library/mlton/pointer.sml.

Although now that I think about it, just having the type is kind of
useless, since you can't do anything with it without the functions. You
probably want to include the whole C_Pointer structure somehow.

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems