Skip to content

Instantly share code, notes, and snippets.

@zootella
Last active December 21, 2015 03:29
Show Gist options
  • Save zootella/6242063 to your computer and use it in GitHub Desktop.
Save zootella/6242063 to your computer and use it in GitHub Desktop.
made-up syntax for mixing static and dynamic typing, and variable and immutable variables, all in the same language at the same time!
//any type, variable value
*a = 7; //make a new variable and set it to 7
a = "hello"; //its a var, so we can set it to something of a different type
//one type, variable value
Text b;
b = "some text";
b = 7; //throws
//any type, permanent value
c: 8; //define new c, giving it the permanent value 8
c = 9; //throws
c = "text"; //throws
//one type, permanent value
Text d: o.toText(); //makes d, permanently sets it to the given text, makes sure it is text
//lock a variable later on
*e = 7;
e = 8;
e: 9; //now e is immutable, it will be 9 from here on out
e = 10; //throws
:e; //instead we could have done this to lock it to the current value
//check and lock function parameters on their way in
function myFunction(f, Date g, :h, Date :i) {};
//f can be anything
//g can by any date
//h can be anything, but can't change
//i is a date that can't change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment