Last active
January 22, 2016 22:27
-
-
Save bvssvni/c473c82242b1460a6741 to your computer and use it in GitHub Desktop.
working on a home made scripting language - name suggestions?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn set_x(a: 'return, val: 'a) -> { | |
a.x = val | |
return val | |
} | |
fn main() { | |
y := {x: {0: 0}} | |
set_x(y, {0: 2}) // ERROR: Requires reference to variable | |
println(y) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some info about the language (mix of Rust, Go and Javascript):
.clone()
though and can unsafely return local variables inside objectsfn foo(a, b: 'a) { ... }
for borrow checking to avoid unsafe codefn foo(a: 'return) -> { ... }
meansa
is a reference that outlives the return valuefor i := 0; i < n; i += 1 { ... }
loops and:=
for variable initialization and=
for mutable assignment[1, 2, 3]
and objects{x: 0, y: 0}
(however,=
expects same type)fn foo() -> { ... }