News for hackers. Stuff that matters.
Re:New language features since Java 8 to 17 by jcelerier on Sunday October 24, 2021 @06:05PM (#28982369)
> Once you know that “Java says X is the first day of the week,”

The basic assumption when designing anything is that you can never rely on assuming that other humans "will" know.

Re:New language features since Java 8 to 17 by xxs on Sunday October 24, 2021 @07:32PM (#28982918)
A funny part is that java has java.util.Calendar that has setFirstDayOfWeek(int), the default depends on the locale used to create the Calendar. It's considered a bad design overall, esp with SUNDAY const being 1. For most of the world that (sun=1) made absolutely no sense at all and assumed one of those weird things like jokes about IQ and room temperature.
Re:New language features since Java 8 to 17 by filoeleven on Sunday October 24, 2021 @07:44PM (#28982998)
> java.util.Calendar that has setFirstDayOfWeek(int), the default depends on the locale used to create the Calendar

That is exactly the kind of hidden assumption that I’m trying to fight against! If the date and the locale were both passed in as parameters, preferably just plain data, this would be a transparent function. Instead, you have to find and read through the documentation to see what kind of mischief is going on. And you have to do that every time you encounter a Java.until.Calendar.

Edit to clarify: if “locale” is some class, you have to learn that class DSL to examine it, and depend on a runtime debugger that does the same. If “locale” is just a hash map, you can examine the values without a lot of faff.

Re:New language features since Java 8 to 17 by filoeleven on Sunday October 24, 2021 @08:03PM (#28983126)
Sure, but how far does that go?

If I try to assign an int value to “3.2” will the language silently fail with null, or a round, or a floor, or a ceiling? Some level of understanding is necessary. I want it to also be reasonably explicit.

Java time library doesn’t meet that standard until Instant.

Re:New language features since Java 8 to 17 by jcelerier on Monday October 25, 2021 @05:52AM (#28986035)
> If I try to assign an int value to “3.2” will the language silently fail with null, or a round, or a floor, or a ceiling?

one may argue that the only correct thing to do here is a compile-time error