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
Enable -howtorun:repl -i -e #5872
Conversation
@@ -46,6 +46,13 @@ object InteractiveReader { | |||
} | |||
|
|||
def apply(): InteractiveReader = SimpleReader() | |||
|
|||
// a non-interactive SimpleReader that returns the given text | |||
def apply(text: String): InteractiveReader = SimpleReader( |
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.
Could we move this to SimpleReader
, as method fromString
or constant
or somesuch?
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.
Maybe. apply
gives you a SimpleReader
for some reason. apply(text)
gives you the same thing, but it only reads from that input. As a user, I don't care that it's a SimpleReader
. WDYT? If I were closer to the city, I'd buy you a beer to discuss.
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.
The owing of beers is all mine! I'm probably overthinking it. By the way, I've just started work on reorganizing the repl codebase to simplify maintenance and stealing of features from ammonite. My goal for the month is some more separation of concerns. Will open a ticket to discuss once I get a sense of the concrete direction I'm headed.
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.
Yes, I expected a clean break from spark support at some point. Also, Ammonite is asking for community funding. What a great idea. I mean dollars, not just beer support.
The runner concatenates -i files and -e expression to run the code as a script. The addition of -I broke detection of -i there, which is now fixed. In addition, allow explicit `-howtorun:repl` which is now useful for `-e`, so that REPL will handle `-i` and `-I` and then evalute the expression as usual (and as the `-help` text implies). Fixes: scala/bug#10284
I acceded to Adriaan's wishes for future It took me forever to write a stupid test, similar to an early test I contributed when fixing
I need that beer now. |
@@ -43,6 +43,13 @@ object SimpleReader { | |||
|
|||
def apply(in: BufferedReader = defaultIn, out: JPrintWriter = defaultOut, interactive: Boolean = true): SimpleReader = | |||
new SimpleReader(in, out, interactive) | |||
|
|||
// a non-interactive SimpleReader that returns the given text | |||
def apply(text: String): SimpleReader = apply( |
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.
Cheers!
} else { | ||
lines drop header.lines.size | ||
}) map normalize | ||
clean.map(normalize) |
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.
Previously seen at 6d8c565
The runner concatenates -i files and -e expression
to run the code as a script. The addition of -I
broke detection of -i there, which is now fixed.
In addition, allow explicit
-howtorun:repl
whichis now useful for
-e
, so that REPL will handle-i
and-I
and then evalute the expression asusual (and as the
-help
text implies).Fixes: scala/bug#10284
Where
dbl.sc
defines overloadedf
(or redefines it if not pasted):I restored REPL output in REPL mode by default, as a use case.