News for hackers. Stuff that matters.
Re:C++ Is the Next C++ by Jtsummers on Wednesday November 02, 2022 @04:49PM (#33442715)
You really think having a type tells you less than having an int? Is the int 0 or 1 based? You don't know. Does the int handle rollover? Nope, you have to. Of course, that's the C way. Worse is better. Fuck sensible type systems and use of them. Let the world burn.

You can look up types, with a bare int you have to pray someone documented it and that they were consistent.

Re:C++ Is the Next C++ by MaulingMonkey on Thursday November 03, 2022 @03:26AM (#33448043)
> You really think having a type tells you less than having an int?

In the case of "Month", yes.

Give me stronger types for dates or timespans or instants though.

> Does the int handle rollover? Nope, you have to.

Rollover tends to need handling at the date level to carry the year, so let's be honest, "Month" won't handle rollover properly on it's own either.

Re:C++ Is the Next C++ by kllrnohj on Thursday November 03, 2022 @12:13PM (#33453258)
> Give me stronger types for dates or timespans or instants though.

So the guideline you're vigorously arguing against you don't actually disagree with at all, you just really, really hate Month for seemingly no reason.

Maybe give the guideline a read rather than just the 2 line snippet someone else posted?

> "Month" won't handle rollover properly on it's own either.

It does by not offering math operators in the first place, avoiding the entire possibility of a rollover from the outset.

Or it could throw on rollover so it's at least an runtime exception instead of a silent failure.