Artella,

> On 14 Sep 2015, at 14:53, Artella Coding <[email protected]> 
> wrote:
> 
> Hi,
> 
> Suppose that I have the following code :
> 
> (* Test.sml *)
> fun f() = print "-------test------";
> val test = f();
> 
> Then if I compile this via "polyc -c Test.sml" the program actually runs 
> before
> emitting an error message :
> 
> -------test------poly: : error: Value or constructor (main) has not been 
> declared
> Found near PolyML.export (List.nth (CommandLine.arguments (), 3), main)
> Static Errors
> 
> Why does the program attempt to run instead of merely compiling?
> 
polyc is just a shell script that runs poly piping in something like:

use”Test.sml”;
PolyML.export(“Test.o”, main);

as the standard input. It expects your ML file to define a function main of
type unit -> unit. In your case you didn’t have such a function hence the error
message. Also you did have some other stuff which was compiled and executed
just as it would have been if you ran poly interactively and typed in the above
commands.

Regards,

Rob.

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

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

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

Reply via email to