tadeuzagallo / verve-lang

A functional language for the working hacker
https://verve-lang.org
MIT License
346 stars 7 forks source link

`let` should put args on the stack. #26

Closed tadeuzagallo closed 8 years ago

tadeuzagallo commented 8 years ago

Right now it just replaces let.lhs with let.rhs, which means that

let foo = expensive() {
  print(foo)
  print(foo)
}

will invoke expensive twice.

Possible test case:

let.ceos:

expensive(): String {
  print("expensive")
  "cheap"
}

let cheap = expensive() {
  print(cheap)
  print(cheap)
}

let.out:

expensive
out
out