Skip to content

Invoke REPL from code #726

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

Merged
merged 1 commit into from
Mar 29, 2017
Merged

Conversation

som-snytt
Copy link
Contributor

A FAQ is how to invoke REPL from code.

Document the common entry points.

@som-snytt
Copy link
Contributor Author

som-snytt commented Mar 5, 2017

This PR experienced an intermediate failure state, I don't know if it's meaningful:

[tut] compiling: ./pt-br/cheatsheets/index.md
[tut] compiling: ./pt-br/tutorials/tour/_posts/2017-02-13-xml-processing.md
Exception in thread "main" java.lang.NullPointerException
	at scala.reflect.internal.SymbolTable.exitingPhase(SymbolTable.scala:256)
	at scala.tools.nsc.interpreter.IMain$Request.x$20$lzycompute(IMain.scala:896)
	at scala.tools.nsc.interpreter.IMain$Request.x$20(IMain.scala:895)
	at scala.tools.nsc.interpreter.IMain$Request.headerPreamble$lzycompute(IMain.scala:895)
at scala.tools.nsc.interpreter.IMain$Request.headerPreamble(IMain.scala:895)

Wait a sec, it had gone green. The failed check prevailed.

A FAQ is how to invoke REPL from code.

Document the common entry points.
@som-snytt som-snytt force-pushed the issue/repl-embedding branch from 05ce72e to 6e6d5c0 Compare March 6, 2017 01:35
}
interpret("""println("hello, world")""")
interpret("""println(""")
interpret("""val who = "world" ; println("hello, $who")""")
Copy link
Member

Choose a reason for hiding this comment

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

missing interpolator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that was to show the warning output. It should probably explain expected output.

Copy link
Member

Choose a reason for hiding this comment

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

sorry, thanks :)

@som-snytt
Copy link
Contributor Author

The script println is missing.

hello, world
OK!
Sorry, try again.
<console>:13: warning: possible missing interpolator: detected interpolated identifier `$who`
        println("hello, $who")
                ^
error: No warnings can be incurred under -Xfatal-warnings.
Sorry, try again.
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111).
Type in expressions for evaluation. Or try :help.

scala> :quit
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111).
Type in expressions for evaluation. Or try :help.

scala> res0: String = hello, world

scala> :quit
Output is Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111).
Type in expressions for evaluation. Or try :help.

scala> hello, world
res0: Int = 42

scala> :quit

@SethTisue
Copy link
Member

@som-snytt is this ready for merge?

@SethTisue
Copy link
Member

(feel free to use your own merge powers if so)

@som-snytt
Copy link
Contributor Author

Let our powers merge!

The doc will change soon anyway with Friendly Repl. FREPL. Or EPFL FREPL.

If anyone reads this and complains, I will make amends by making emends.

@som-snytt som-snytt merged commit d175460 into scala:master Mar 29, 2017
@som-snytt som-snytt deleted the issue/repl-embedding branch March 29, 2017 23:13
@SethTisue
Copy link
Member

🎵 Just want to drink my REPL wine, down in the Lightning Bar 🎵

@scabug scabug mentioned this pull request Apr 7, 2017
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.

3 participants