[MLton] Install problem

Bin Li lib@purdue.edu
Tue, 4 Nov 2003 11:08:33 -0600


Dear Stephen Weeks:

Thank you for your help.

I'm trying to figure out the "unresolved bugs" from http://www.mlton.org/user-guide/Unresolved_bugs.html even I still do not know much about ML. :) I ran the command as: mlton -verbose 3 error.sml and I thought the type error happened in the fun checkType (ty: Type.t): unit in mlton/xml/type-check.fun (around line 33). I tried to print something to see what's in the 'scope', but I don't know how and what to print. :P 
(I also traced into the lib/mlton/basic/property-list.fun and added a print function for fun get and set, I thought it was used in the type-check. but when I re-compiled and ran the command again. it seems that neither of the two functions are called in this case.)

I'm familiar with C++, and I found there are many different between ML and C++. Such as in C++, if you want to call a structure's function directly, the function has to be static, or you have to define a instance of the structure first. But in ML, I chould call a structure's function directly. Isn't it? So I wonder in which conditions one is better than another? and could we combine them together?

Thanks,
Bin Li

----- Original Message ----- 
From: "Stephen Weeks" <sweeks@sweeks.com>
To: "Bin Li" <lib@purdue.edu>
Cc: <MLton@mlton.org>
Sent: Monday, November 03, 2003 3:55 PM
Subject: Re: [MLton] Install problem


> 
> > By the way, do you have any suggestion for the debugging? I'm not
> > familiar with ML language. Can I set breakpoints in my program or
> > can I see the values of variant in the running time?
> 
> Unfortunately, MLton does not have a debugger.  It is fairly high on
> our list of things to work on, and we would love to find someone else
> who would like to do it that we could help.  But it is almost
> certainly a year or more away.
> 
> In the mean time, there are of course print statements.  :-)
> 
> You can also use polymorphism and higher-order functions to build your
> own debugging aids.  For example, you could implement
> 
> val debug: ('a -> string) * ('b -> string) -> ('a -> 'b) -> ('a -> 'b)
> 
> This function could then handle pretty printing of arguments and
> results, indentation for nesting, all under the control of some flag
> (bool ref).
> 
> We've done a pretty full (and complicated) implementation of this idea
> in the MLton sources.  See lib/mlton/basic/trace.{sig,sml} in the
> mlton sources.
> 
> http://cvs.mlton.org/cgi-bin/viewcvs.cgi/mlton/mlton/lib/mlton/basic/trace.sig?rev=HEAD&content-type=text/vnd.viewcvs-markup
> 
> It's quite a lot to digest, though.  And since you're new to ML, it
> would probably be very instructive to build your own infrastructure
> along the lines above.
>