Working on a package to give interactive tutorials for new Julia users. Hit a stumbling block that I’m not convinced has a good answer. Basically here’s what I want to happen:
Hi juliatutor user type `println("hello world")` and hit the return key.
> println("hello wurld")
Sorry that's not the solution we asked for try again.
> println("hello world")
Good job! Let's move on to the next task.
So far I was able to mimic this behaviour with the readline() function. But there are serious downsides to using that function when compared to a typical REPL input! For example, hitting the arrow keys in a readline displays some character annotation for the keypress and doesn’t move the cursor (eek)
This would frustrate a new user and not provide anything like the REPL experience they would get by closing the package. Full REPL incorporation isn’t needed, but being able to get something closer than readline() offers would be awesome.
The current code for this can be found here:
I’ve looked into REPLMaker.jl at the suggestion of others and the base code for REPL’s itself but quick attempts at getting what I wanted didn’t work out. Does anyone have any good ideas for this? Or is this hopeless for now?
I for some reason didn’t think to look at Pkg, or Debugger. Great idea. I’ll take a peek at those sometime soon and give this another try. I know how I’d go about doing this in another Language but in Julia it’s a little more nuanced so following the road more traveled should help a lot.