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

Flexible root calls #166

Merged
merged 2 commits into from
Jan 17, 2021
Merged

Flexible root calls #166

merged 2 commits into from
Jan 17, 2021

Conversation

BastianBlokland
Copy link
Owner

Support more kinds of call statements as root statements. The following statements are now legal as root calls:

import "std/console.nov"
import "std/lazy.nov"

print{string}("Hello World")

(print{string})("Hello World")

print("Hello World")

intrinsic{stream_write_string}(intrinsic{console_openstream}(1), "Hello World\n")

act getStream() -> sys_stream
  intrinsic{console_openstream}(2)

act customPrint(sys_stream stream, string message)
  intrinsic{stream_write_string}(stream, message);
  intrinsic{stream_write_char}(stream, '\n');
  intrinsic{stream_flush}(stream)

customPrint(getStream(), "Hello World")

actSeq(
  lazy print("Hello"),
  lazy print("World")
)

Also this PR adds support for calling pure functions in root statements. Even though its not really useful to call a pure
function from the root (as it wont have any output) there is no real reason to disallow it and can be useful for testing.

Even though its not really usefull to call a pure
function from the root (as it wont have any output)
there is no real reason to disallow it and can be usefull
for testing.
@BastianBlokland BastianBlokland enabled auto-merge (squash) January 17, 2021 13:01
@BastianBlokland BastianBlokland merged commit 6e2a6d8 into master Jan 17, 2021
@BastianBlokland BastianBlokland deleted the feature/flexible-root-calls branch January 17, 2021 13:19
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.

1 participant