[MLton] implement _address and _symbol

Stephen Weeks MLton@mlton.org
Wed, 20 Jul 2005 23:57:05 -0700


> 3. When using _symbol *, somehow the wrong type shows up:
> Error: test.sml 17.10.
>   Function applied to incorrect argument.
>     expects: [?.pointer] * _
>     but got: [MLton.Pointer.t] * _
>     in: setip (addr, 5)
> ... because of this I have not been able to test _symbol *.
> 
> val addr = _address "x" : MLton.Pointer.t;
> val (getip, setip) = _symbol * : MLton.Pointer.t, int;
> val () = setip (addr, 5)

I suspect that you made the setter created by _symbol * use the
expansion of MLton.Pointer.t rather than the opaque type specified in
the expression.

> There's also this annoyance:
> Warning: <basis>/misc/primitive.sml 1386.13.
>   _import of constant is deprecated. Use _symbol.
...
> Should I convert the basis to use (#1 _symbol "x" : X;) () instead of
> _import "x": X; -- or do you wish we had _fetch "x": X; now? ;-)

Yes, please convert.  And no, not at all :-).

> All in all, I am amazed at how easy it has been so far. 

Aren't statically typed languages grand.