Idiomatic camel case rules. Is chrono behaving badly?

Using chrono I need a use line like:

use chrono::{Timelike, Datelike, DateTime, TimeZone, Utc, Duration}; //,Local};                                         

There is DateTime and Datelike one is camel case and one is not (? I am not a language lawyer?)

Is this "bad"? Seems to me to violate the principal of least astonishment.

Datelike is one word, so this is the correct camel casing


I am astonished!

1 Like

That's a bit of a pun though, since "datelike" specifically refers to the fruit.


Timelike refers to....
That is a good point. I did not read that link to wiktionary properly, thank you.
So it is a error because it is not a fruit, it is a date....
Relieved that I was right to type use chrono::DateLike appalled that I was wrong to write....

While I'm no longer an active maintainer of Chrono, I assure you that Datelike and Timelike were intended to be a single word. :wink: More specifically, I thought that <noun>like is perfectly fine because "timelike" is really a word (as does "spacelike").

Funny what you learn, tangential to what you study.
I had no idea that <noun>like is a valid word construction.

1 Like

True, I think it's a great pun ¯_(ツ)_/¯

1 Like

As a native English speaker, I am surprised that "datelike" even appears in the dictionary, and I certainly hold no value to the claim that it refers "specifically to the fruit," even if that's what the dictionary (or a dictionary-like site) claims.

It's a common construction you can apply to any noun. The only notable exception I can think of is that sometimes it's hyphenated and sometimes it's not, based on some strange unspoken rule none of us can put into words. (all I can say is that it's obviously "barberlike" and not "barber-like", even though none of us have use for such a word)

None of those define "datelike" in particular.

I suppose proper camel case will depend on whether you think a particular case should be hyphenated.

That's enough language-lawyering for me -- Happy Friday!

1 Like

British English uses hyphens to form these new words by compounding, and American English does not. And when programming Rust, we have no choice, and can't use the hyphen (except I think if we were to use raw identifier syntax but let's not).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.