←back to thread

517 points bkolobara | 1 comments | | HN request time: 0s | source
Show context
veber-alex ◴[] No.45042068[source]
I find the Zig example to be shocking.

It's just so brittle. How can anyone think this is a good idea?

replies(5): >>45042182 #>>45042784 #>>45043157 #>>45045393 #>>45046983 #
kouteiheika ◴[] No.45043157[source]
Every language has questionable design decisions that lead to brittle code, although some more than others.

Like, how can anyone think that requiring the user to always remember to explicitly write `mutex.unlock()` or `defer mutex.unlock()` instead of just allowing optional explicit unlock and having it automatically unlock when it goes out of scope by default is a good idea? Both Go and Zig have this flaw. Or, how can anyone think that having a cast that can implicitly convert from any numeric type to any other in conjunction with pervasive type inference is a good idea, like Rust's terrible `as` operator? (I once spent a whole day debugging a bug due to this.)

replies(2): >>45043445 #>>45050774 #
vjerancrnjak ◴[] No.45050774[source]
I would like a language where your call stack can't be bigger than two/three.

You can call functions inside your function Main, but these function can't call any functions anymore (exception being flat helper functions defined inside your function).

I think it would save a huge chunk of time by just having all programs really nice and flat. You'd naturally gravitate towards mechanisms that make programs flat.

replies(1): >>45051874 #
1. dboreham ◴[] No.45051874{3}[source]
Also allows founding of: The Flat Program Society.