News for hackers. Stuff that matters.
Re:Switching from C++ to Rust by howinteresting on Monday March 13, 2023 @08:23PM (#35145399)
I'm going to make the even stronger claim that a general-purpose statically typed language that doesn't support sum types and exhaustive pattern matching to at least the extent that Rust does is unfit for general use, just like a language that doesn't have product types is unfit for general use.

Dynamically-typed languages often have adhoc sum types.

Re:Switching from C++ to Rust by unclad5968 on Monday March 13, 2023 @08:55PM (#35145748)
Well that's obviously not true given all the successful apps written in languages that don't support sum types.
Re:Switching from C++ to Rust by tialaramex on Monday March 13, 2023 @09:14PM (#35145956)
It depends what you take "unfit" to mean.

Suppose I say that cars without seatbelts are "unfit" to use on public roads. Clearly I can't mean it's impossible to use such cars, people used to do it all the time, but perhaps I mean it's a bad idea to use them, and that's harder to argue with which is why we got laws saying you need seatbelts.

Re:Switching from C++ to Rust by andrewflnr on Monday March 13, 2023 @09:49PM (#35146255)
A lot of successful apps were written with GOTO. That doesn't mean it's a good idea now.
Re:Switching from C++ to Rust by mikebenfield on Monday March 13, 2023 @09:24PM (#35146045)
I know your claim will strike some people as absurd, but I agree. I am honestly flabbergasted that any general purpose language created in the last 20 years doesn't have sum types and pattern matching. To me they are very nearly as fundamental as aggregate types (aka structs or product types).
Re:Switching from C++ to Rust by johnny22 on Monday March 13, 2023 @10:12PM (#35146444)
even php has some level of pattern matching now.
Re:Switching from C++ to Rust by the_gipsy on Tuesday March 14, 2023 @08:29AM (#35150399)
What does php not have by now, is the question.