top | item 45057442

(no title)

zawaideh | 6 months ago

Feels like it’s taking the best of Rust and Ruby (with Python style whitespace)

Admittedly it’s just a first impression

discuss

order

harikb|6 months 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

xscott|6 months ago

I 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.

Aardappel|6 months ago

In 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.

alain_gilbert|6 months ago

For 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.