> I personally use two conditionals for such case.
Me too. But that often makes my logic worse. Its quite common to want to share the same code in the else branch, for example:
if let Some(val) = opt {
if expr {
// ....
} else {
do_complex_stuff();
}
} else {
do_complex_stuff();
}
I don't want to copy+paste that complex code in two places. And you can fix that in turn with a named block & named break statements or a function - but .... whyyyyy? Why is this even a thing? The solution is so obvious. The RFC you linked to fix it is fine, and 6 years old now. My sister has a child in grade school who was born after that RFC was drafted.
Yes, you can work around this hole in the language any number of ways with ugly code. But I don't want to do that. I want to use a good language.
I'm worried that you want a "good" language at any circumstance, which is not even generally possible but also at odds with other aspects of languages. This still counts as minor for me because it is just slightly annoying and doesn't make something impossible or much harder to read (and the readability varies enough that this threshold is much higher than this case).
> I'm worried that you want a "good" language at any circumstance, which is not even generally possible but also at odds with other aspects of languages.
Yes, I do want a good programming language. I agree its relatively minor compared to the other issues I talked about in the blog post.
In what way is this at odds with other aspects of the language? If its at odds with the rest of the language, why is this feature being added?
Me too. But that often makes my logic worse. Its quite common to want to share the same code in the else branch, for example:
I don't want to copy+paste that complex code in two places. And you can fix that in turn with a named block & named break statements or a function - but .... whyyyyy? Why is this even a thing? The solution is so obvious. The RFC you linked to fix it is fine, and 6 years old now. My sister has a child in grade school who was born after that RFC was drafted.Yes, you can work around this hole in the language any number of ways with ugly code. But I don't want to do that. I want to use a good language.