|
|
|
|
|
by jokab
2080 days ago
|
|
>The readability of those structures is highly dependent on the language and how it expects serial conditionals to be most efficiently written. My knowledge is limited only to c# thus c style languages so i am curious how you would write the contrived conditional statements in the article to be more readable in any other language that would make it more readable than guard clauses |
|
Tangentially, this probably wouldn't be a very idiomatic piece of code to write in Haskell, since some of the conditions are likely to be mutually exclusive (what does it mean when isDented is False but isBigDent is True?) My instinct would be to model the status as a sum type, and then to pattern match on its inhabitants instead of writing helpers for 'hasInsurance,' 'isTotaled,' etc, but someone with proper professional Haskell experience might have an even slicker way to think of it.