Skip to content

Ticket 162 - expressions computing return values a la Rust/R#166

Merged
lutzhamel merged 2 commits intodev-1.0.0from
ticket-162
Apr 24, 2022
Merged

Ticket 162 - expressions computing return values a la Rust/R#166
lutzhamel merged 2 commits intodev-1.0.0from
ticket-162

Conversation

@lutzhamel
Copy link
Copy Markdown
Collaborator

The fixes introduced here allow programs such as

let x = (lambda with i do i+1) 1.
assert(x is 2).

and

load system io.

function f1 with () do
   3+3.
   io @println "hello".
   5.
end

function f2 with () do
   3+3.
   io @println "hello".
end

assert(f1() is 5).
assert(f2() is none).

where the last expression evaluated in a function body computes the return value of that function.

@lutzhamel lutzhamel requested review from TimColaneri and olwmc April 24, 2022 17:38
@lutzhamel lutzhamel changed the base branch from master to dev-1.0.0 April 24, 2022 17:40
@olwmc
Copy link
Copy Markdown
Collaborator

olwmc commented Apr 24, 2022

where the last expression evaluated in a function body computes the return value of that function.. I didn't think of it this way but that's very interesting! I like it. Sort of works like the yield keyword in python. Nice!

@lutzhamel lutzhamel merged commit 421953b into dev-1.0.0 Apr 24, 2022
@lutzhamel lutzhamel deleted the ticket-162 branch April 24, 2022 23:48
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.

2 participants