-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Interpreter: allow some options, and colorize whereami #12198
Interpreter: allow some options, and colorize whereami #12198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
Could you also add |
I initially added prelude, but the interpreter depends on exit and nothing really works without the prelude. For example inspecting values won't work. Link flags... I think that's a new feature. When will they show up? I actually intended to add coloring support in this PR. I added some other options that were trivial to implement. Could we maybe leave the other, more colplex ones, for later PRs? |
Never mind about What do you mean by |
When you do
crystal/src/compiler/crystal/interpreter/repl.cr Lines 182 to 184 in 8eb1413
Without the default prelude, that doesn't work. Well, maybe it will work with some other prelude, but not with the empty one. I guess we could still add the option. After all it's a "use this if you want to, but you probably shouldn't". Here's how it works right now with
Not a very pleasant experience :-) Here's interpreting a file that only does
Again, not very useful. But I guess it doesn't hurt either to add that option to be able to experiment with other preludes. |
Yes, I agree on that. Choosing a non-standard prelude is an option which is only useful when you know what you're doing. Even with compiled crystal. I think it makes sense to allow it on the interpreter as well. We could easily improve the error messages or fall back to not calling methods that don't exist. (that's low priority though) |
Will this make it to 1.5.0? |
Sure. It only affects the interpreter. |
This PR allows passing the following options to the interpreter:
-D FLAG
--error-trace
-h
--no-color
In addition to that, if color is desired, the output of
whereami
and also the output when you run intodebugger
is colored.Before this PR:
With this PR:
With this PR and
--no-color
(notice that the line numbers are no longer colored):