3 ms·
> "Don't use Booleans as parameters" ... except I think it's perfectly fine in languages that support named parameters. In fact this isn't even specific to boo
by dheera 7y ago
> "Don't use Booleans as parameters"
... except I think it's perfectly fine in languages that support named parameters. In fact this isn't even specific to booleans. Say we're using Python,
draw_rect(width = 5, height = 10, top = 5, left = 6)
is much more readable than
draw_rect(5, 10, 5, 6)
- turingbike 7y agoNamed parameters _might_ be my favorite part of Python. I don't understand why every language doesn't have them.
- simplyinfinity 7y agoC# also has them and it's amazing !
- astrange 7y agoObjective-C and Swift also. Though my favorite implementation is AVISynth, the best language and most interesting execution model nobody uses.
- Izkata 7y agoFor languages that don't (and depending on the usage, maybe ones that do), I'd like to throw out another possibility for those who haven't seen it before: Fluent interfaces draw_rect(5, 10).at(5, 6) draw_rect().from(5, 6).to(10, 16) It's one I'd be careful with though, as it can be easy to end up with something less readable.