|
|
|
|
|
by tOkeshu
4294 days ago
|
|
I generally find that using tuples of booleans this way is (sometimes) blurring the intent. Indeed, not only you have to keep in mind which boolean value correspond to which variable, but you also have to not forget what's the meaning of true and false here. So what about the following?: match (width, margin_left, margin_right) {
(auto, _, _) => { ... }
(_, auto, auto) => { ... }
(_, auto, _) => { ... }
(_, _, auto) => { ... }
(_, _, _) => { ... }
}
Now that I write this, I can understand this style is trickier as the order here is critical.
The "debate" between `match` and `if` reminds me of the same one that exists in Erlang, where I saw people more often use `case of` with booleans instead of `if`.Moreover, is there any performance issue with matching auto for every tuple? |
|