Skip to content
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

Add option to run REPL after running a program #10692

Closed
wants to merge 1 commit into from
Closed

Add option to run REPL after running a program #10692

wants to merge 1 commit into from

Conversation

s2maki
Copy link
Contributor

@s2maki s2maki commented Mar 31, 2015

Currently, running julia program.jl causes Julia to exit after the program finishes. For program development, it frequently makes sense to stay in the REPL after the program finishes. This pull request adds the -I option (--force-repl long option) to do this.

@jakebolewski
Copy link
Member

How is this different than julia -i -L test.jl? I don't think we want to start introducing flags that just combine additional functionality.

@s2maki
Copy link
Contributor Author

s2maki commented Mar 31, 2015

There are several reasons.

The -L option is meant to load modules since it calls require(), whereas the program argument is passed to include(). If this wasn't an important distinction, there wouldn't be a need for a -L option, either. It's also not possible to have multiple -L options, so if you needed -L and a program and to end in the REPL, there's presently no option for that.

The -L option is processed before almost any other option, including the load of .juliarc.jl and the creation of additional procs with -p or --machinefile. A program may need those resources.

Plus, it's more generally useful. It can be used in conjunction with --eval or --print, and therefore eliminates the need for -P, because -I -e <expr> could replace -P <expr>.

@JeffBezanson
Copy link
Member

It sounds like -L is a bit broken; the help for it says the file is loaded on all processors. .juliarc.jl should definitely be loaded as early as possible. The order in client.jl doesn't seem right to me.

I agree the -e, -E, -P, and -L options are too complicated. All you actually need are -e and this PR's -I. Instead of debating whether to use require or include, you should use -e to get whichever you want.

@JeffBezanson
Copy link
Member

I see --startup-file=yes also changes the order in which .juliarc is loaded. That's not at all obvious. Since our current way of handling options does not execute them left to right, you can't control the order so it should always be the same.

@jakebolewski
Copy link
Member

It would be great to remove some of these redundant options.

@kmsquire
Copy link
Member

kmsquire commented Apr 1, 2015

#10713

@lstagner
Copy link
Contributor

lstagner commented Apr 7, 2015

Couldn't there be a function that opens up the REPL from within a program. Something like repl()

@josefsachsconning
Copy link
Contributor

Could someone please clarify what are the obstacles to merging this PR?

@ihnorton
Copy link
Member

It would be best to fix the existing options rather than add a new one.

@ihnorton ihnorton closed this May 19, 2015
@josefsachsconning
Copy link
Contributor

What exactly is the broken option? Should -i cause the REPL to be run? Is that what "Force isinteractive() to be true" in the --help output means? Is there an existing issue for that?

@ihnorton
Copy link
Member

Right now -i just means "make isinteractive() return true" (see #6765). I think -i should mean "run-to-REPL" by default, like Python and bash. I don't believe this would conflict with IJulia or Gtk.jl/Julietta usage because they take over the event loop, but if it is a problem we could probably check whether isatty to decide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants