Comment by raincole

Comment by raincole a day ago

1 reply

> It was an interesting read, but I guess I came away confused about why "coloring" functions is a problem. Isn't "coloring" just another form of static typing?

It is. Function coloring is static typing.

But people never ever agree on what to put in typing system. For example, Java's checked exceptions are a form of typing... and everyone hates them.

Anyway it's always like that. Some people find async painful and say fuck it I'm going to manage threads manually. In the meanwhile another bunch of people work hard to introduce async to their language. Grass is always greener on the other side.

vips7L 17 hours ago

> But people never ever agree on what to put in typing system. For example, Java's checked exceptions are a form of typing... and everyone hates them.

I love checked exceptions. Checked errors are fantastic and I think most developers would agree they want errors to be in the type system, but Java as a language just hasn’t provided the language syntax to make them usable. They haven’t made it easy to “uncheck” when you can’t possibly handle an error. You have to write boilerplate:

    Something s;
    try {
        s = something();
    } catch (SomethingException e) {
        throw new RuntimeException(e);
    }

It sucks when you face that situation a lot. In Swift this is really simple:

    var s = try! something();
Java also hasn’t made them usable with lambdas even though both Scala [0] and Swift have shown it’s possible with a sufficiently strong type system:

    try {
        someCall(s -> {
            try {
                another(s);
            } catch (CheckedException ex) {
                throw new UncheckedException(ex);
            }
        });
    } catch (UncheckedException ex) {
        // handle somehow
    }

It sucks. I’m hopeful one day we’ll get something like try! or try? and better lambdas. Maybe once all resources stop being poured into Valhalla.

[0] https://docs.scala-lang.org/scala3/reference/experimental/ca...