|Anonymous | Login | Signup for a new account||2016-10-20 21:42 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005232||OCaml||OCaml general||public||2011-02-26 21:36||2014-10-31 09:41|
|Target Version||Fixed in Version|
|Summary||0005232: wish: -str option for ocaml|
|Description||Sometimes it is useful to be able to run simple oneliner ocaml code without writing the code previously to file. Option -str analoguos to one of camlp4 is wanted.|
I think that this feature doesn't really work:
- the compilers (ocamlc and ocamlopt) need the filename to be used as a compilation unit name, so simply passing code in -str wouldn't work (except if this is only intended for parsing/typing with option -i?)
- the toplevel already makes it easy to work with short pieces of code (in particular `cat "foo;;" | ocaml`), so I'm not sure an -str option to ocaml would make much sense.
ygrek, could you be more specific on the use-cases and semantics you had in mind?
|yes, this was intended exactly as a shorthand for toplevel, but with the following implied features : be usable as script runner, i.e. no extra toplevel output (prompts and types), stdin available for input (with toplevel it results in End_of_file), no reading of ocamlinit (not sure about this one). The intended use-case - running some automated utility tasks (inside project directory) where the actual code is available in a cma or ml file and one-liner is needed to actually call it or run with specific parameters.|
edited on: 2013-07-29 18:35
Thanks for the additional information. That seems reasonable. I think it's also reasonable to not run the .ocamlinit, because the "-stdin" option already doesn't do that. In fact I suspect they should both read .ocamlinit, and have a -noinit option (can be obtained as -init /dev/null right now), but that's question that can be handled independently (in fact it is an existing PR: PR#6071).
|Seems related to 0006631|
edited on: 2014-10-31 09:42
Indeed; kyoDralliam, could you repost your patch here, using `-str` rather than `-e`?
PS: in case the patch is merged, the name you use in your .patch would be used as attribution information.
|2011-02-26 21:36||ygrek||New Issue|
|2011-05-17 15:42||doligez||Status||new => acknowledged|
|2013-07-28 22:42||gasche||Note Added: 0009946|
|2013-07-28 22:42||gasche||Assigned To||=> gasche|
|2013-07-28 22:42||gasche||Status||acknowledged => feedback|
|2013-07-29 04:36||ygrek||Note Added: 0009959|
|2013-07-29 04:36||ygrek||Status||feedback => assigned|
|2013-07-29 07:04||gasche||Tag Attached: junior_job|
|2013-07-29 07:04||gasche||Assigned To||gasche =>|
|2013-07-29 07:15||gasche||Note Added: 0009962|
|2013-07-29 07:15||gasche||Status||assigned => confirmed|
|2013-07-29 07:16||gasche||Relationship added||related to 0000352|
|2013-07-29 18:35||gasche||Note Edited: 0009962||View Revisions|
|2013-09-18 16:37||lpw25||Relationship added||related to 0006071|
|2014-10-29 22:28||kyoDralliam||Note Added: 0012468|
|2014-10-31 09:40||gasche||Relationship added||has duplicate 0006631|
|2014-10-31 09:41||gasche||Note Added: 0012478|
|2014-10-31 09:42||gasche||Note Edited: 0012478||View Revisions|
|Copyright © 2000 - 2011 MantisBT Group|