3 ms·
For me is hard to understand how a language with a behavior/constraints like you describe get so much noise about "been easy to use/learn". I do not like it bu
by mingodad 11y ago
For me is hard to understand how a language with a behavior/constraints like you describe get so much noise about "been easy to use/learn".
I do not like it but at least be DRY as much as possible:
case 0: set.__fds_bits.0 |= mask
- mikeash 11y agoWhat you're seeing here is a result of an unfortunate interaction with bridging to C APIs. fd_set is a C struct which contains a fixed-length array. Swift doesn't have fixed-length arrays, so those get translated to tuples instead. This is not ideal, but it comes up almost never. As for your suggestion, that seems like an entirely stylistic thing. DRY is about not copy/pasting large chunks of code, not minimizing individual lines by using compound mutate/assign operators. I've never seen anyone say (before!) that something like `x = x + 1` violates DRY.
- weego 11y agoMore importantly nothing about DRY overwrites the ideal that making the intent of your code explicitly clear is more important then fixating on micro optimisations. I feel like the code as it is less easy to misunderstand while skim read.