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) | |
} |
Some info about the language (mix of Rust, Go and Javascript):
- Just developed for fun right now
- Using Piston-Meta for parsing, so people can change the syntax without recompiling
- Goal: To develop a scripting language that is ordinary - specifically avoiding weird or fancy stuff
- Does not use a garbage collector yet - uses lots of
.clone()
though and can unsafely return local variables inside objects - Might be able to use
fn foo(a, b: 'a) { ... }
for borrow checking to avoid unsafe code - If borrow checking is added,
fn foo(a: 'return) -> { ... }
meansa
is a reference that outlives the return value - Go like
for i := 0; i < n; i += 1 { ... }
loops and:=
for variable initialization and=
for mutable assignment - Dynamically typed, similar to Javascript: Arrays
[1, 2, 3]
and objects{x: 0, y: 0}
(however,=
expects same type) - Function declaration similar to Rust
fn foo() -> { ... }
- Variable name shadowing like in Rust
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For name suggestions: See PistonDevelopers/piston#1029