Alex, I don't know if you intended to send this to the list as well but I'm copying it back there because I think it might be of general interest.
While I was playing around with the polyc script I wondered about adding a --usestring option, similar to --use but with the actual ML in there rather than the file name. Similar to the -e option to sed and awk rather than the -f. It would then be possible to include the command to load your saved state on the poly command line.
e.g. poly --usestring "PolyML.SaveState.loadState"$SAVE";" --use ...
Would that work? David
On 05/04/2013 13:48, Alex Merry wrote:
On 05/04/13 13:24, David Matthews wrote:
I've added a "polyc" script that is generated from the build process. The idea of this is to provide the similar sort of functionality that users of C expect from the "cc" command. It's very simple at the moment and is limited to a few options. It compiles an ML source file and exports the "main" function. The -o option specifies where the executable is to be placed, defaulting to a.out on Unix.
This sounds really useful.
One thing I would find useful is an option to load a saved state before using a file; in Quantomatic, we save the build state, then have some executables built on top of that (and also have a way of getting a toplevel with that state).
Of course, we could just load the state from the file that contains the main function, but that means either hard-coding the path to the saved state in those files or having option-parsing boilerplate at the top of each file to get the path of the saved state.
Currently, our build scripts have an -l/--load option (the two are equivalent) to do this.
Alex
Yeah, I did mean to send it to the list. I'm used to mailing lists that edit the reply-to header.
That would also work (although would put the burden of doing proper escaping on the script). I'm not sure that "--usestring" is the most descriptive option name. Maybe "--eval"?
Alex
On 05/04/13 13:58, David Matthews wrote:
Alex, I don't know if you intended to send this to the list as well but I'm copying it back there because I think it might be of general interest.
While I was playing around with the polyc script I wondered about adding a --usestring option, similar to --use but with the actual ML in there rather than the file name. Similar to the -e option to sed and awk rather than the -f. It would then be possible to include the command to load your saved state on the poly command line.
e.g. poly --usestring "PolyML.SaveState.loadState"$SAVE";" --use ...
Would that work? David
On 05/04/2013 13:48, Alex Merry wrote:
On 05/04/13 13:24, David Matthews wrote:
I've added a "polyc" script that is generated from the build process. The idea of this is to provide the similar sort of functionality that users of C expect from the "cc" command. It's very simple at the moment and is limited to a few options. It compiles an ML source file and exports the "main" function. The -o option specifies where the executable is to be placed, defaulting to a.out on Unix.
This sounds really useful.
One thing I would find useful is an option to load a saved state before using a file; in Quantomatic, we save the build state, then have some executables built on top of that (and also have a way of getting a toplevel with that state).
Of course, we could just load the state from the file that contains the main function, but that means either hard-coding the path to the saved state in those files or having option-parsing boilerplate at the top of each file to get the path of the saved state.
Currently, our build scripts have an -l/--load option (the two are equivalent) to do this.
Alex
On 05/04/2013 20:26, Alex Merry wrote:
Yeah, I did mean to send it to the list. I'm used to mailing lists that edit the reply-to header.
I had another look at the list settings and mailman provides an option to do this but strongly discourages its use.
That would also work (although would put the burden of doing proper escaping on the script). I'm not sure that "--usestring" is the most descriptive option name. Maybe "--eval"?
I don't like "usestring" myself. "eval" is definitely better. I see what you mean about having to escape the string if it has unusual characters in it. I don't really like the idea of having a special "load file" option, though. It seems too much like a special case.
David
On 08/04/13 12:07, David Matthews wrote:
I don't like "usestring" myself. "eval" is definitely better. I see what you mean about having to escape the string if it has unusual characters in it. I don't really like the idea of having a special "load file" option, though. It seems too much like a special case.
Well, the --eval option would work for Quantomatic (after all, we control the relative paths, so we can make sure there are no odd characters), but - for the interpreter in particular - I think that "start in this saved state" is a reasonable option.
Alex
On 09/04/2013 12:44, Alex Merry wrote:
On 08/04/13 12:07, David Matthews wrote:
I don't like "usestring" myself. "eval" is definitely better. I see what you mean about having to escape the string if it has unusual characters in it. I don't really like the idea of having a special "load file" option, though. It seems too much like a special case.
Well, the --eval option would work for Quantomatic (after all, we control the relative paths, so we can make sure there are no odd characters), but - for the interpreter in particular - I think that "start in this saved state" is a reasonable option.
I've added a --eval argument. We'll see how that goes and think about other possibilities once there's been an opportunity to try this out.
--eval and --use can be mixed on the command line and are executed in order before the main loop is entered. If any fail or raise an exception the whole poly command exits with an OS.Process.failure result.
David