←back to thread

611 points LorenDB | 2 comments | | HN request time: 0s | source
Show context
GardenLetter27 ◴[] No.43908148[source]
It's a shame Rust doesn't have keyword arguments or named tuples to make handling some of these things easier without Args/Options structs boilerplate.
replies(5): >>43908333 #>>43908500 #>>43908653 #>>43912118 #>>43913516 #
jsat ◴[] No.43908653[source]
Had the same thought... It's backwards that any language isn't using named parameters at this point.
replies(1): >>43909426 #
Ygg2 ◴[] No.43909426[source]
Named parameters do come with a large footgun. Renaming your parameters is a breaking change.

Especially if you're coming from different langs.

replies(3): >>43912194 #>>43913869 #>>43938686 #
const_cast ◴[] No.43912194{3}[source]
This only really applies to languages that don't check this at compile-time. I don't consider compile-time errors a foot gun. I mean, it should be impossible for that kind of bad code to ever get merged in most reasonable CI/CD processes.
replies(1): >>43913166 #
1. Ygg2 ◴[] No.43913166{4}[source]
No? This happens in any language that has keyword args.

If I delete/rename a field of a class in any statically checked language, it's going to report a compile error, and it's still a breaking change. Same thing with named arguments.

replies(1): >>43920766 #
2. const_cast ◴[] No.43920766[source]
Sure, but it doesn't actually matter because this can't ever manifest as a bug. Your PR will just be rejected, which to me, is correct behavior.

Typically when you're changing a name you're changing behavior, too. This isn't just something we should let slip under the radar, otherwise bugs can actually manifest.