Continuing my experiments, I came across sml_tk ( http://www.informatik.uni-bremen.de/~cxl/sml_tk/doc/manual.html) which looks promising. It is also a little old (uses PolyML 4). I ran the Makefile to install it and find it fails trying to do a commit. I noticed that there seems to have been a change in Poly 5.5.2 that removes PolyML.commit). I see in the sml_tk source this line (in poly.sml) : PolyML.comit(); ..so I wonder, what do I replace that with? I see this instruction in Poly v 5 : PolyML.export("mypoly",PolyML.rootFunction);
but that is a precursor to doing a compile? cc -o mypoly mypoly.o -lpolymain -lpolyml
i.e. Those 2 lines replace the idea from v 4 of doing commit?
-Dave
On Sat, Dec 13, 2014 at 9:04 AM, David Topham <dtopham at gmail.com> wrote:
The X-Windows/Motif code still builds as far as I'm aware but that's as
far as it goes. I would say it was better to use something else through CInterface.
The Poly/ML interactive environment (read-eval-print loop or REPL) is usually the easiest way to develop and test your code. It prints the types and values of top-level expressions. When building an application it is probably easier to use "polyc". This is really a wrapper script for "poly" which compiles, exports and links a stand-alone application. You need to define a function called "main" that is the root function of your application.
$ cat > testme.ML fun main() = print "Hello World\n"; $ polyc testme.ML $ ./a.out Hello World
David Matthews
Thanks for your reply David, I will look into using CInterface. That makes me think that another approach could be to use an imperative
language
for the GUI and link in the ML functions! That way existing GUI
builders
could be used. I will experiment.
I did get the interactive version of the sample Motif code to work OK, but failed to get it to build stand-alone (i.e. using polyc). Perhaps the polyc script doesn't include the needed Motif libraries? But also, my limited understanding of how to incorporate that GUI code into a main function may be to blame. I will keep trying, but after more reading, I am beginning to think that my idea to use the CInterface backwards: calling ML code from C rather than the other way around is not going to work! I had been thinking that instead of wrapping some new GUI library around ML (like the Motif code which seems to be obsolete), I could use existing C/C++ GUI frameworks and have the logic of the program be in ML, but that means calling ML functions from C. Can that be done?
What surprises me is that all these years of people using ML, but no one has felt the need to write stand-alone programs for end-users that have a GUI?
I don't see any example code that does that (I did see Polychrome within a web browser). ...and some examples that mention Isabelle has an IDE -- not PolyML though, just SML/NJ? and with Java required?)
-Dave