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
Hi, I'm filing this tongue-in-cheek, but I hope it's edifying.
I did a coding test for a job today. I used clj-time. I got the right answers. Later on I was embarrassed I had used a deprecated library, and so I decided to upgrade to current best practices.
My issue boils down to: in the java time api, you can't parse a LocalDate from a formatter like "yyyy". For example:
(jt/local-date "yyyy" "2024")
will get you
java.time.DateTimeException
Unable to obtain LocalDate from TemporalAccessor: {Year=2024},ISO of type java.time.format.Parsed
The problem here seems somewhat philosophical to me. Here the library is just faithfully wrapping java.time, but due to the brittle type hierarchy, that results in code which really smells like java, somewhat defeating the purpose. Maybe there's nothing that can be done here? But in the off chance anyone has thoughts about a layer that could be added to make a more clojure-like API, I'd be interested to hear.
The text was updated successfully, but these errors were encountered:
Hi, I'm filing this tongue-in-cheek, but I hope it's edifying.
I did a coding test for a job today. I used clj-time. I got the right answers. Later on I was embarrassed I had used a deprecated library, and so I decided to upgrade to current best practices.
My issue boils down to: in the java time api, you can't parse a LocalDate from a formatter like "yyyy". For example:
will get you
This leads to code like this:
instead of this clj-time code:
The problem here seems somewhat philosophical to me. Here the library is just faithfully wrapping java.time, but due to the brittle type hierarchy, that results in code which really smells like java, somewhat defeating the purpose. Maybe there's nothing that can be done here? But in the off chance anyone has thoughts about a layer that could be added to make a more clojure-like API, I'd be interested to hear.
The text was updated successfully, but these errors were encountered: