What seems to be happening is that the "-q" option from polyc sets the print depth to zero to prevent unnecessary output during compilation. This then gets inherited by the executable. The solution is to set the print depth before starting the shell e.g.

fun main () = (PolyML.print_depth 50; PolyML.shell());

David

On 05/09/2017 17:06, [email protected] wrote:
If I write foo.ML:

````
fun main() = PolyML.shell()
````

and compile this with polyc:

````
$ polyc foo.ML -o foo
````

the resulting executable doesn’t give me the usual acknowledgements of my 
declarations:

````
$ ./foo
3;
4;
print "hello\n";
hello
3 + true;
poly: : error: Type error in function application.
    Function: + : int * int -> int
    Argument: (3, true) : int * bool
    Reason:
       Can't unify int (*In Basis*) with bool (*In Basis*)
          (Different type constructors)
Found near 3 + true
Static Errors

````

Here I’d have expected to see lines like `val it = 3 : int`.  The behaviour 
after the compilation of the print call suggests that stdout is live, and that 
things really are being compiled. The error message after the last interaction 
is similarly reassuring.

If I call PolyML.main() inside a standard poly shell (a funny thing to do), it 
does work as expected.

I also tried to write code like that behind PolyML.shell by hand, and though I 
was providing a CPOutStream TextIO.print, I also failed to see any output from 
the compiler.

Is there something I should be doing differently?

Michael

_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to