-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Scripting solution #10491
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
Scripting solution #10491
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0d6ba8c
to
d713412
Compare
d600d2f
to
17e8f4a
Compare
nicolasstucki
suggested changes
Dec 11, 2020
We are also missing some docs. |
c03e824
to
8d68bc0
Compare
8d68bc0
to
246b5a1
Compare
nicolasstucki
approved these changes
Dec 11, 2020
I have used scala for several years, and make heavy use of scala scripting. I am eager to contribute to this and have some ideas to greatly improve the user experience for new users. |
This will make it much easier to run quick test comparisons between Scala 2 and 3! |
I have a dream that jrunscript -cp lib/scala3-compiler_3.0.0-M3.jar:lib/scala3-library_3.0.0-M3.jar:lib/scala3-interfaces-3.0.0-M3.jar:lib/tasty-core_3.0.0-M3.jar:lib/scala-library-2.13.4.jar:lib/scala-asm-7.3.1-scala-1.jar -Djava.class.path=lib/scala3-library_3.0.0-M3.jar:lib/scala-library-2.13.4.jar -l scala |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds scripting support to Scala 3. Given a source named
Test.scala
:You can run:
./bin/scala ../playground/foo/Test.scala World
to get an outputHello World
.Internally,
scala
detects the first residual argument which ends with*.scala
. It then assumes it to be a file that the user wants to run as a script, and all the arguments after that file are treated as the arguments to that script.A "script" is an ordinary Scala file which contains a
@main
method. The semantics of thescala Script.scala
command are as follows:Script.scala
withscalac
into a temporary directory*.class
files produced by the compilation