News for hackers. Stuff that matters.
Re:Are Implicit Operators a Path to Clean Code or a Buggy Ni... by Guvante on Wednesday August 09, 2023 @12:13AM (#37058614)
Implicit can make things hard to understand meaning it should be used with caution.

But allowing CustomInt i = 0; instead of CustomInt i = CustomInt::Zero; or worse CustomInt i = static_cast<CustomInt>(i); isn't a bad thing.

Re:Are Implicit Operators a Path to Clean Code or a Buggy Ni... by vbezhenar on Wednesday August 09, 2023 @12:27AM (#37058694)
For me this looks fine:

var i = CustomInt.valueOf(0)

Re:Are Implicit Operators a Path to Clean Code or a Buggy Ni... by joaonmatos on Wednesday August 09, 2023 @06:40AM (#37060799)
Can’t you do `auto i = CustomInt(0)`? Then all of the construction is explicit (and in a single place in the statement) without repeating.