Carl Mäsak

Results 649 comments of Carl Mäsak

## Enums xxx https://graydon2.dreamwidth.org/253769.html is a good post about sum types/discriminated unions -- takeaway, in my opinion, is that you win from pushing the idea of "can't access the wrong...

Having written #410, I'm more convinced we need to do this _anyway_ to get that semantics/implementation. Because of the "leapfrogging" example in #410 (you can Ctrl+F for it), I don't...

#372 ties into this, since it wants to tie precedence/associativity information to _definition sites_. #410 pushes us in the same direction, at compile-time, a variable reference is basically a reference...

Rust has a ["once cell"](https://crates.io/crates/once_cell) crate. Food for inspiration. All of a sudden I'm also reminded of Josh Bloch's insistance that the singleton pattern [should be implemented using enums](https://www.informit.com/articles/article.aspx?p=1216151&seqNum=3). This...

Linking to [this blog post](https://maxgreenwald.me/blog/do-more-with-run), which I just discovered. A more palatable alternative to an IIFE. The example with `return` in the OP won't work — nor will anything else...

> We'd want to extend: > - `my` and `constant` declarations: `my count: Int = 0;` > - Parameters: `sub add(lhs: Int, rhs: Int) { ... }` and `-> s:...

> Function types have a `->` in them to separate the types of the parameters from the return type, like `Int -> Str`. Following tradition, the `->` separator is right-associative,...

One great way to map this out would probably be to implement the whole type checker as an honest-to-blog 007 program which (magically) got the Qtree of the program-to-be-type-checked as...

Hm, Which one of these makes more sense? ``` sub foo(x: Int): Int { return x } sub foo(x: Int) -> Int { return x } ``` In all the...

One strike against using `->` is that this would be allowed: ``` sub foo(x: Int) -> Int -> Int { return sub(y: Int) -> Int { # assumed: `sub` expressions...