You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The semantics of true or false are often hard to understand without extensive context. Using enums (with just two values, but descriptive identifiers) may be a better route.
The text was updated successfully, but these errors were encountered:
As an example for this, simplify_expr returns true when the expression was simplified and false when it wasn't. If you see code like if(simplify_expr(expr)) you need to know this to read the code; If it was something like if(simplify_expr(expr) == Simplify::ChangedExpression) it'd be easier to discern the meaning (this isn't a parameter in this case, but basically the same logic applies).
It's certainly worth having a discussion about the places where we use "meaningful" booleans like this (i.e. where a boolean is used as a generic two-value thing instead of an actual True/False thing).
The semantics of
true
orfalse
are often hard to understand without extensive context. Using enums (with just two values, but descriptive identifiers) may be a better route.The text was updated successfully, but these errors were encountered: