Skip to content
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

Print result of main (if not Nothing) #3696

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Sep 12, 2022

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:

main = "Hello World!"

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 is IO.print ... (which returns Nothing), 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 the engine-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 use Standard.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:

  • All code conforms to the
    Scala,
    Java,
    and
    Rust
    style guides.
  • All code has been tested:
    • If GUI codebase was changed: Enso GUI was tested when built using BOTH
      ./run ide build and ./run ide watch.

@JaroslavTulach JaroslavTulach changed the title Make sure result of main is printed (if not Nothing) Print result of main (if not Nothing) Sep 12, 2022
Copy link
Contributor

@4e6 4e6 left a comment

Choose a reason for hiding this comment

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

Looks good. Only request is to change the output to stdout

Copy link
Contributor

@hubertp hubertp left a comment

Choose a reason for hiding this comment

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

Same request as the others

@JaroslavTulach JaroslavTulach force-pushed the wip/jtulach/PrintMainResult_183136313 branch from 6d852a7 to 3672edd Compare September 12, 2022 14:57
@JaroslavTulach JaroslavTulach added the CI: Ready to merge This PR is eligible for automatic merge label Sep 12, 2022
@mergify mergify bot merged commit 40ef4a0 into develop Sep 12, 2022
@mergify mergify bot deleted the wip/jtulach/PrintMainResult_183136313 branch September 12, 2022 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants