New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wish: -str option for ocaml #5232
Comments
Comment author: @gasche I think that this feature doesn't really work:
ygrek, could you be more specific on the use-cases and semantics you had in mind? |
Comment author: @ygrek 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. |
Comment author: @gasche 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: #6071). |
Comment author: kyoDralliam Seems related to #6631 |
Comment author: @gasche Indeed; kyoDralliam, could you repost your patch here, using PS: in case the patch is merged, the name you use in your .patch would be used as attribution information. |
Comment author: @mshinwell @gasche Could you take care of these two issues? |
Comment author: @gasche The patch is not good enough (for example it creates a temporary file but never deletes it, littering the user's filesystem with useless source files) and I had no feedback/return from the contributor. I can't spend time making a better patch right now, so as far as I am concerned the feature request is still standing, and any user's contribution is welcome. |
Hi, I think I'm gonna work on this for my first contribution. Where in the toplevel folder would I find what I need to edit to support this option? Also an example of some usage behavior would be nice to clarify what I would need to do. Thanks! Sorry for all the questions. |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
@notemaster sorry for not answering this. Here would be an usage example: # the following currently works
$ echo 'print_endline "Hello World";;' | ocaml -stdin
Hello World
# the following would requires this feature
$ ocaml -str 'print_endline "Hello World";;'
Hello World |
can i pick up this issue? |
Language interpreters usually use I can see |
maybe -e, --eval ? |
I agree that |
Fixed by #10438 . |
Original bug ID: 5232
Reporter: @ygrek
Status: confirmed (set by @gasche on 2013-07-29T05:15:41Z)
Resolution: open
Priority: normal
Severity: feature
Version: 3.12.0
Category: toplevel
Tags: junior_job
Has duplicate: #6631
Related to: #2757 #6071
Monitored by: @gasche @ygrek
Bug 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.
The text was updated successfully, but these errors were encountered: