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

RFC: new REPL #6270

Merged
merged 11 commits into from
Mar 29, 2014
Merged

RFC: new REPL #6270

merged 11 commits into from
Mar 29, 2014

Conversation

nolta
Copy link
Member

@nolta nolta commented Mar 26, 2014

@loladiro's REPL.jl code, plus the path completion behavior from #5343, and a few minor bugfixes.

Keno and others added 7 commits March 26, 2014 00:17
Fixes #1773 (Repl autocompletion for composite type fields).
Fixes #3652 (Segfault during TAB-completion on OSX).
Fixes #4477 (Tab completion for `using` should look up installed packages).
A symptom of this is if

    ext(c)<left><left><left><tab><enter>

is entered into a fresh session, the output is

    extrema (generic function with 2 methods)

instead of the expected

    ERROR: c not defined
@StefanKarpinski
Copy link
Member

This is such a satisfying branch.

@StefanKarpinski
Copy link
Member

I think we should merge this as soon as possible. Thanks, @nolta, for putting in the work to merge @loladiro's REPL stuff and thanks @loladiro for writing it in the first place. This really brings our REPL to the next level – and it was already good.

@tkelman
Copy link
Contributor

tkelman commented Mar 26, 2014

Is this spawning anything posixy? This branch builds (some warnings during bootstrap, Warning: could not import Base.showerror into Test, Travis had the same) and passes tests on Windows (and replacing dependencies with better Julia implementations is great!), but trying to start the REPL interactively from a Windows prompt gives me a

D:\code\msys64\home\Tony\julia\test>..\usr\bin\julia-basic.exe
ERROR: spawn: no such file or directory (ENOENT)
 in _jl_spawn at process.jl:212

Or from an MSYS2 prompt I get (this is probably because of #4589)

$ usr/bin/julia-basic.exe
ERROR: no method convert(Type{TTY}, Pipe)
 in UnixTerminal at no file

@tkelman
Copy link
Contributor

tkelman commented Mar 26, 2014

I think I found it. Changing

hascolor(t::UnixTerminal) = (beginswith(t.term_type,"xterm") || success(`tput setaf 0`))

in Terminals.jl, line 207, to

@unix_only hascolor(t::UnixTerminal) = (beginswith(t.term_type,"xterm") || success(`tput setaf 0`))
@windows_only hascolor(t::UnixTerminal) = true

fixes it.

@JeffBezanson
Copy link
Member

I think we should rename Readline so it is not confused with being a wrapper for that library.

@StefanKarpinski
Copy link
Member

That's a good idea. Of course, then we need a good name. How about LineEdit?

@tknopp
Copy link
Contributor

tknopp commented Mar 26, 2014

Is this going to be 0.3 stuff? I find the idea kind of appealing although it is a quite major change. Having tested REPL.jl I did not have problems so far (on OS X).

if !isdefined(:put!)
const put! = put
const take! = take
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.2 compatibility is not required for a module in base.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah. Good catch :-)

@elehcim
Copy link
Contributor

elehcim commented Mar 26, 2014

Hello, I'm on linux. My del button does not work with this repl. See Keno/LineEdit.jl#2.

One more thing is that when you enter shell or help mode, there's no way to go out from it if you entered some text, unless you delete all the text. On the original readline, you could just delete the ; or ? character. I'd like to see something like going to the first position of the line and press backspace to restore julia mode.

In fact, the specular action now is possible: type some text in julia mode, go to the first position and type ; or ? and in this way the relative mode is triggered.
Thanks

@StefanKarpinski
Copy link
Member

One more thing is that when you enter shell or help mode, there's no way to go out from it if you entered some text, unless you delete all the text. On the original readline, you could just delete the ; or ? character. I'd like to see something like going to the first position of the line and press backspace to restore julia mode.

Yes, I would love this feature too. Not sure if @loladiro has the time right now, but I suspect for anyone who understands the new REPL, this wouldn't be too hard to do.

@tkelman
Copy link
Contributor

tkelman commented Mar 26, 2014

One thing that's a little surprising with this REPL is if I hit tab before typing anything, I get a list of every single visible keyword. Intended or not? Suppressing tab completion if the line is empty would be more consistent with the old readline REPL.

@mbauman
Copy link
Member

mbauman commented Mar 26, 2014

That's a more general change in tab-completion behavior with REPL.jl @tkelman. Readline performs completions with one tab press and lists the possibilities with two. The behavior here is to either complete or list possibilities if no completion is available on each tab press.

There was also a custom hook on hitting tab after a function call (fn(<tab>) where it would show methods(fn). I really liked that.

I'd also like to start working on getting movement-by-word (\e[f, \e[b, \e[d, etc) and the kill-yank buffer working again.

But all this can be added more easily after merging.

Also, hoist all the using/imports to the top.
@StefanKarpinski
Copy link
Member

Having all of this implemented cleanly in Julia – as opposed to hacked to death in C with readline – really opens up the possibilities for fancy behaviors.

@StefanKarpinski
Copy link
Member

Is this now working on Windows? If so, should we merge it? I think that as long as it works on all platforms, it's fair to merge it and then continue to fix bugs on master.

@carlobaldassi
Copy link
Member

Having all of this implemented cleanly in Julia – as opposed to hacked to death in C with readline – really opens up the possibilities for fancy behaviors.

Yes, and regarding the filename completion: when I did it it was really a quick hack, it should be redone properly in julia (using parse, probably). Anyway this is not worse than what we had, so it could be done after merging. One additional failure scenario which was not mentioned in #5343 may occur if there are quotes or backticks within comments.

@tkelman
Copy link
Contributor

tkelman commented Mar 26, 2014

Is this now working on Windows?

Builds, passes tests (with the exception of a known Windows failure in test/file.jl), and basic functionality appears to work.

        From worker 2:       * euler
        From worker 2:       * show
        From worker 3:       * readline
        From worker 3:       * replcompletions
        From worker 3:       * parallel
    SUCCESS
blas_num_threads=8

D:\code\msys64\home\Tony\julia\test>..\usr\bin\julia-basic.exe
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+2175 (2014-03-26 21:52 UTC)
 _/ |\__'_|_|_|\__'_|  |  mn/newrepl/fd19a97* (fork: 10 commits, 0 days)
|__/                   |  x86_64-w64-mingw32

julia> print
print            print_joined      print_unescaped   println
print_escaped    print_shortest    print_with_color

@ihnorton
Copy link
Member

Looks good. Binary here if anyone wants to test: https://julialang.s3.amazonaws.com/bin/winnt/x64/0.3/julia-0.3.0-prerelease-x86_64-newrepl.exe

@tknopp
Copy link
Contributor

tknopp commented Mar 27, 2014

Confirming that this windows binary works without issues on windows.

- fix cmove_* fallbacks
- remove unused Colors & Attributes code
- get rid of submodules
- deindent
StefanKarpinski added a commit that referenced this pull request Mar 29, 2014
@StefanKarpinski StefanKarpinski merged commit c6dfebc into master Mar 29, 2014
@StefanKarpinski StefanKarpinski deleted the mn/newrepl branch March 29, 2014 19:03
@johnmyleswhite
Copy link
Member

Awesome. :)

@Keno
Copy link
Member

Keno commented Mar 30, 2014

I'm contemplating backporting these to the REPL.jl packages, but it seems like a bad idea to maintain it in two places.

@ViralBShah
Copy link
Member

I am getting:

Undefined symbols for architecture x86_64:
  "_ispty", referenced from:
      _jl_tty_get_winsize in jl_uv.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/Users/viral/julia/usr/lib/libjulia.dylib] Error 1
make[1]: *** [julia-release] Error 2
make: *** [release] Error 2

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.