Am 11.10.2013 15:42, schrieb David Matthews: > On 11/10/2013 14:17, René Neumann wrote: >> Am 11.10.2013 15:12, schrieb Ramana Kumar: >>> (Ie, what I want: if is_script then main() else () ) >>> >>> If your main : unit -> unit (which perhaps it must be?), then main() is >>> equivalent to the if expression above, modulo side-effects. >> >> There is a misunderstanding here: I need the main to be run with poly >> --script -- which does not run it by default. But if I'd include 'main >> ()' in the script itself, it'd be run on compiling too (which I'd like >> to avoid). >> > > I'm still unclear what you're trying to achieve. Are you trying to > write a single file that can either be used as a script or run through > polyc to generate a stand-alone executable? If so, you're going to have > a problem with the #! line because it is only treated specially if > --script is given. If you try to run the file through polyc it will > complain about a syntax error. > > You should be able to discover whether you are running as a script by > looking for the presence of the --script option using > CommandLine.arguments().
Thanks! This was the information I was looking for. Some explanation for my use case: For debugging an application, I'd like to run it with "polyc --script" (not using the shebang) as this prints out intermediate datastructures. When I only need the pure output w/o interleaved compiler output, I want to use the compiled executable. @David: Have you seen my other issue in the original email? - René -- René Neumann Institut für Informatik (I7) Technische Universität München Boltzmannstr. 3 85748 Garching b. München Tel: +49-89-289-17232 Office: MI 03.11.055
smime.p7s
Description: S/MIME Kryptografische Unterschrift
_______________________________________________ polyml mailing list [email protected] http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
