Print result of main (if not Nothing) #3696
Merged
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.
Pull Request Description
The goal of this request is to simplify hello world and other trivial Enso programs. No need to learn any standard library functions, enough to write:
and the result is going to be printed:
enso$ ./built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/enso --run hello.enso 'Hello World!'
the result is only printed, if it is not
Nothing
. E.g. if the last statement isIO.print ...
(which returnsNothing
), then no value is printed at the end by the launcher.Why is this Important?
The simplification of hello world is a nice side-effect, but it is not the primary reason why this functionality is important.
There is a task to Add missing @TruffleBoundary to make Enso code compilation more effective. The only way to verify that there are no missing
@TruffleBoundary
annotations is to build theengine-runner
project with GraalVM Native Image - #3638. However just building the engine isn't enough, we also need to test it by executing a sample script and verify it computes the right output. However, at current stage, the Native Image compiled Enso executable cannot load standard library - e.g. it cannot useStandard.Base.IO.println
to print anything...With here in proposed functionality we can invoke the script, compute its result and let the
engine-runner
infrastructure print the output. We can compile all of that into native executable right now - e.g. we will be able to properly test the Add missing @TruffleBoundary task in our CI.Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.