Sujet : Re: “Booleans Considered Harmful”
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.programmingDate : 22. May 2025, 23:33:49
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <100o8od$3mk15$3@dont-email.me>
References : 1 2
User-Agent : Pan/0.162 (Pokrosvk)
On Thu, 22 May 2025 11:14:17 +0200, Julio Di Egidio wrote:
But we know better: the one best practice that would be relevant there
is *do not use magic values*.
I think the writer was trying to make a point about cryptic actual-
argument values. But that is an issue that applies to other types besides
booleans, and is easily solved by passing arguments by keyword. Compare
his example
saveUser(user, true, false);
with something more like
saveUser
(
user,
sendWelcomeEmail := true,
verified := false
);