60 karma · joined July 31, 2020
adam-mcdaniel.net
``` enum Option<T> {Some(T), Nothing}
// Create a value with an inline type that doesn't use the nominal `Option`
let opt1 = enum {Some(Int), Nothing} of Some(5);
// Define a second option value, which is assigned with the first
let opt2: Option<Int> = opt1;
// Print the result
println(opt2); ```
You can create a variant of an inline `enum` type, and then typecheck it against another structurally equal type if you so choose!
I hope this example properly illustrates how powerful the structural type-checking is with enums!
I love these suggestions, especially Moss and Ivy! Thank you!
This is the work that inspired Sage: Harbor (https://github.com/adam-mcdaniel/harbor). My goal with Sage was to take everything that makes a brainfuck-like programming language easy to compile, while also keeping all the time complexity and optimizations of regular algorithms. So, in that sense, it started out as an attempt to design around a Turing machine -- I wanted this to be a dialect of brainfuck. The VM doesn't use any stack operations, just operations on a tape pointer + an accumulator!
Thanks for checking out the project, I'm glad I was able to surprise you haha! :)
I might just go with a completely made up word to avoid any trademarks entirely haha
I put all the example programs in text on the web-demo, though, if you want to see more there! You can copy, read, or modify them there!
https://adam-mcdaniel.net/sage
It's different from Rust in that it has structural typing and a more Python-like experience! Types are constants, and can be printed with `print` like other values
Thanks for your input! I hope you like the project!
But definitely no garbage collection (although, a target could implement it against the standard and it would work)
Thanks for checking out the project!