> 1) More readable code. The classic is foo.Bar(true). It breaks the flow of reading to have to hover and see what that 'true' means. Much nicer to see foo.bar(launchMissiles: true).
This is a case where I've started using Enums in Java. For example:
foo.bar(LaunchMissiles.YES);
In Rust, you could have a macro to make defining these types easier (and have it automatically generate to_bool and from_bool methods):
This is a case where I've started using Enums in Java. For example:
In Rust, you could have a macro to make defining these types easier (and have it automatically generate to_bool and from_bool methods):