Re: How to correctly use (second-class) modules?

Geoffrey Alan Washburn <[email protected]> Wed, 07 Feb 2007 17:30:06 -0500
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
(Sorry if this winds up a duplicate, my e-mail client was having 
difficulties with the gmane NNTP gateway this morning)

John Reppy wrote:
 > The third solution is to use a OO approach: define a record of
 > pretty-printer operations.


Actually there is yet another I didn't think to mention, but I also 
don't take it too seriously: do terrible things with the exn type.


 > For the SML/NJ pretty-printing library, I chose the functor approach,
 > where the pretty-printing engine is parameterized over a device
 > module.  Different backends (e.g., text, html, ...) are implemented
 > by different devices.  I could have used a record type for the device
 > interface, which might be a better choice.


As I pointed out OO doesn't (quite) work out in this case because of the 
pretty-printer uses an abstract datatype.  At least I haven't been able 
to figure out a way to get around that problem -- if I am wrong I would 
be glad to find out how :-)  However, maybe I can work something out by 
refactoring the abstract pretty-printer into the frontend that 
everything currently uses and the output based upon a device like you 
suggest.  It would be reasonable for the device to be entirely stateful, 
thus eliminating the need for an abstract datatype.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642