8 ms·
Feels like it’s taking the best of Rust and Ruby (with Python style whitespace) Admittedly it’s just a first impression
by zawaideh 1y ago
Feels like it’s taking the best of Rust and Ruby (with Python style whitespace)
Admittedly it’s just a first impression
- harikb 1y ago> Flow-Sensitive Type-Inference imho, I don't consider Type-inference as a good thing when it happens from 50 lines ahead/below. How would regular people follow along? Good case x = "hello" // infer type as string - good thing. Bad case var/declare x; 50 lines later if (....) x = "world" // infer type as string - this is bad
- alain_gilbert 1y agoFor case like this, I'd say your text editor should definitely just be able to tell you right away that this variable is a "string" when you mouse over it.
- harikb 1y agoIt shouldn't require a fancy forward-lookup-capable editor / language-server to show type. That is the point I am trying to make var/declare x; 25 lines later call f(x); // ** Reader has no idea what x is ... even though compiler has ** 25 lines later if (....) x = "world" // infer type as string - this is bad
- Aardappel 1y agoIn Lobster you must initialize a variable declaration. Now you can produce your bad case with `var x = nil`, but that is undesirable because nil types must be explicitly checked at compile time, so typically you want to use as few nils as possible. More likely thus is `var x = ""` if you must initialize later.
- xscott 1y agoI agree with your point in general, and I'm curious if it's a problem in Lobster. Here's one in Rust: let i = 1; let j = 1; print!("i: {:?}\n", !i); print!("j: {:?}\n", !j); // pretend there's a lot of code here // spooky action at a distance let v = vec![1, 2, 3]; v[i]; You might think those two print statements would print the same value. They do not.