Hi,
I'm writing a program that runs Poly/ML as a child process, redirecting standard input and output. I'm working on the Windows XP platform.
Poly/ML behaves suboptimally in this setting. I'm experiencing two problems. One problem is fatal, the other is very annoying.
The fatal problem is that Poly/ML simply hangs at some point during the interaction. I suppose it's some kind of deadlock. The problem is reproducible in that it happens at the exact same point, every time I run the program with the same input. But the entire environment in which the program runs is so big (it's Isabelle) that I'm not going to try to describe it. I'm just hoping that someone out there already knows about this. I don't have a debugger now, but when I get hold of one, I will try to hunt down the bug myself.
The annoying problem is that Poly/ML goes to sleep for 0.5 seconds after every command. My program feeds hundreds of commands at a time to Poly/ML, so this means a *huge* slowdown. Putting all commands on a single line is not an option, since I need to stop feeding commands as soon as a command prints an error message. I think I found the cause of this sleeping problem: it's the MsgWaitForMultipleObjects call in processes.c. In the comments in the source code, David Matthews explains that it's just too hard to avoid this. I'm sure that's true in the general case, when you're running many lightweight processes, all of which are reading, writing, doing GUI stuff, etc., but in my case, Poly/ML is really just a simple sequential single-threaded read-eval-print loop. So, what I'm saying is, would it be possible to do some special-casing for the one-lightweight-process case on the Windows platform, so that you could just do blocking I/O calls? (This would probably also solve the fatal problem described above.) And I also don't really need the DDE functionality, so that we could do away with the message pump.
These problems would have caused me to defect to another ML implementation, if it wasn't that Poly/ML is simply by far the best implementation out there. Many thanks to David Matthews for this great piece of software! But again, I hope there is some way to fix these problems.
Bart