3 ms·
If you support only a subset of the standard, or if you extend the standard, that may still be OK (not without problems, but still OK in some situations). This
by jeffdavis 14y ago
If you support only a subset of the standard, or if you extend the standard, that may still be OK (not without problems, but still OK in some situations).
This case seems like an outright violation, however. If the standard says that ####-## is a year-month date with month granularity, and you interpret it as an ordinal date, then that's a clear violation. It means that others communicating with you won't just get an error, they will get the wrong answer, which is much worse.
- badgar 14y agoSo it's not even a subset of ISO 8601, it's just the umpteenth ad-hoc date parsing method with semantics defined as "portion of a 3k line C file with no comments": https://github.com/ruby/ruby/blob/7ea675732ac1dac72f07756498706678d8725719/ext/date/date_parse.c#L2600 https://github.com/ruby/ruby/blob/7ea675732ac1dac72f07756498... PS I did my undergrad thesis on Ruby; I love the language. But now that I have a job where people read my code more often than it's written, I understand why things like clear semantics matter. And why method names should be precise since they lead developers to assume behavior. Didn't your english teacher tell you a poem's title means something? So do method names. "iso8601" implies some meaningful relationship to ISO 8601, but the only relationship here is that the coders of this method were thinking hard about ISO 8601 when they wrote it.