[MLton-devel] Porting HOL to MLton

Joe Hurd joe.hurd@comlab.ox.ac.uk
Fri, 17 Oct 2003 01:57:54 +0100 (BST)


On Thu, 16 Oct 2003, Stephen Weeks wrote:

> > Is there such a casting function in MLton?
>
> No.  I don't know enough about mosmllex to know how easy these are to
> workaround.  Can you give us an idea of the casts used?

I think I know how to rewrite the lexer definition so that the
generated lexer doesn't need these casting functions. They're used so
that the lexer can pretend that every action has the same type,
whereas each entry point (lex class) might generate a chain of actions
with its own type. By creating a datatype with a constructor for each
lexer entry point, I think that the actions will all have the same
type, and so the occurrences of Obj.magic can be replaced by the
identity function.

Sorry for the rather long and confusing explanation. I don't
fully understand the problem myself yet.

> > 2. What is the exception raises by TextIO.openIn?
>
> val _ =
>    (TextIO.openIn "/foo"; ())
>    handle IO.Io _ => print "ok\n"

Interesting. If I cut and paste this code into the end of my source
code, it produces

data/prove.sml:300.12-300.17 Error: unbound constructor IO.Io
compilation aborted: elaborate reported errors

It turns out the reason is that earlier in the file is

open OS;

at the top level (trying to align the Moscow ML and MLton top-level
environments). Replacing this with

structure FileSys = OS.FileSys;
structure Path = OS.Path;
structure Process = OS.Process;

solves all the problems.

Thanks for your help,

Joe



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel