60 points · by pjmlp · 5y ago · 80 comments
What are these features?
This could be things like "pattern matching and sum types", or it could be things like "effect systems and dependent types". Personally I don't think you can reasonably call pattern matching an "innovative feature" from an "academic programming language", but as far as I can tell that's what they mean...
Ultimately all objects/structs/records are at their core tuples. But we refer to their attributes by name for a good reason.
match (a, b) with:
(4, 2) => "Hello"
(1, 0) => "World"
(_, _) => "nope" match (n % 3, n % 5) with:
(0, 0) => print "FizzBuzz"
(1, 0) => print "Fizz"
(0, 1) => print "Buzz"
(_, _) => print nJS has made a few steps in allowing us to have objects as compact as a tuple, i.e. {foo, bar, baz}.
I think we need more effort in that direction. But keep fields addressable by name at all times. In fact, ordered arguments in functions have the same problem (they're a tuple). Unfortunately that ship has sailed.
Besides, you may end up with divergences in your community about how local a tuple should be allowed to be. Can it be passed to a lambda? Can you map over it in a local context? etc. Overall, deciding where tuples should be used is an easy choice for the developer, and a very hard choice for the language creator.
In combination it looks very much like they mixed it up.
fn main() {
let a = String::from("Hallo");
let a = 3;
}I could then call
a = "hallo"
// can call String methods, runtime checked
a = 3
// can call int methods, runtime checked
in Python also variable shadowing. But in this case you assume a is the same but the type changes, and call it dynamic typing, while in the Rust example you assume the two a's are not the same variable: let a = String::from("Hallo");
// can call String methods, compiler checked
let a = 3
// can call i methods, compiler checked
One could argue there is a difference with method signatures def f( a )
a = "hallo"
f(a)
a = 3
f(a)
which does work in Python ("dynamic") but not in Rust ("static").But then the actual usage of "a" in the method effectively puts it on the same level as interfaces in Rust and blurs further with static languages like Typescript without nominal types.
The language seems to draw lots of inspiration from Rust. Not sure how polished their type system is, though.
The pitch is also a bit unclear to me about which users are being targeted. In my experience, small languages that don't focus on a single area have a hard time, and aside from "modern functional language features" (and modern functional languages are a dime a dozen these days), there doesn't seem to be lots of specific about the target space.
On the other hand, it is nice to see that there is LSP support provided for the language.
There are a bunch of languages that compile to webassembly, including Rust, Golang, Python (via Pyodide), and Kotlin, so that by itself isn't a great competitive differentiator either.
If they don't respect your time and attention now, extrapolate.
Benefit: a larger language, Drawback: a language not designed explicitly for the purpose.
Reading between the lines, it’s statically-typed, compiles to assembly, and I haven’t seen a type annotation yet, but I’ve seen a “let rec,” so maybe it’s similar to OCaml? Or even Ocaml in disguise again? But perhaps they decided to obscure that for marketing reasons, as if adopters of hot-off-the-press programming languages are just programmers looking for something nondescriptly “modern”, rather than programming language enthusiasts.
This language has polymorphism and mutation, like OCaml. I wonder how they avoid the "value restriction" problem that in OCaml forces you to write type annotations in some places: https://ocaml.org/manual/polymorphism.html
The are declared using `let rec foo = ()=> ...` syntax. So the modifier is on the variable declaration rather than the function definition. Since recursiveness is a property of the function this seems like the wrong way round. JavaScript gets this right with `async`.
In other words, the default behaviour is that the scope, during variable definition, does not include the variable being defined. With "rec" the variable being defined is added to the scope in the definition of the variable itself.
Coming from lambda calculus, this makes sense: functions themselves cannot be recursive. What makes them recursive is taking their own definition as a parameter, I.e. getting their name in their scope.
It's not exactly a trivial algorithm as it involves finding strongly connected components from the dependency graph and then topologically sorting that.
I implemented this for a toy programming language compiler project, it was a fun one. Luckily I had SCC and topological sort from Haskell's Data.Graph module.
And some stuff which might normally be in a standard library.
Didn't read anything about concurrency, etc.
I was looking for a clue if this was a wrapper for Typescript to eventually run on the V8 Javascript engine.