Although a lot of thought has gone into naming things in Raku, occasionally some sources of confusion are found. This ticket for now should serve as a place to collect these so that we can have a decision on how to act on them later.
DateTime.truncated-to should be called DateTime.truncate-to.
Please correct me if I'm wrong, but DateTime.round-to would be a new method, no? If so, then that doesn't belong in this ticket, I'd say.
Are there any guidelines on whether - or _ should be used in method names? Some classes (like Parameter) use both, which I think can be confusing.
@Kaiepi I am under the impression that "-" with lower case is the Raku way.
Are there any guidelines on whether - or _ should be used in method names? Some classes (like Parameter) use both, which I think can be confusing.
I'd like to gradually transition to - everywhere, though some cases will be tricky. Nowadays, _ is used in:
Much of the latter will be swept away with RakuAST (which I guess is more of a compiler external :-)), and I'm going with the - convention throughout there. We'll also rename the grammar rules to follow the - convention before we spec any names there as part of slangs. I don't really want to commit to the grammar rule names in the upcoming language release - there isn't time to think slangs through enough, or those names - and so it's tempting to leave the _s to shout "still guts!". However, the pragmatic answer may well be to just do it on the RakuAST switch, since everyone with a module dabbling in that area is going to have to fix it on the RakuAST transition anyway. I won't promise not to break them again when we do slangs properly, but at least it stands a chance of lessening the impact then.
DateTime.truncated-toshould be calledDateTime.truncate-to.
Speaking of DateTime, its timezone method should be deprecated/removed, because it's confusing and its functionality is provided by offset. Most other libraries use offset (or variants on it like gmt[-]off[set]) to refer to this value.
I think most users would assume that timezone implies getting some sort of a value like Central European Time (geopolitical name), PDT (abbreviation) or Asia/Seoul (Olson ID), which it doesn't, although that functionality can be added via modules. Deprecating and removing it would free up those modules to safely return strings or enums for that method
Are there any guidelines on whether - or _ should be used in method names? Some classes (like Parameter) use both, which I think can be confusing.
Yeah, I suggested to switch to - everywhere years ago. There isn't really a well defined rule. Back then it was greeted with opposition for weird reasons, it's nice to see it move in the right direction now.
Most helpful comment
I'd like to gradually transition to
-everywhere, though some cases will be tricky. Nowadays,_is used in:Much of the latter will be swept away with RakuAST (which I guess is more of a compiler external :-)), and I'm going with the
-convention throughout there. We'll also rename the grammar rules to follow the-convention before we spec any names there as part of slangs. I don't really want to commit to the grammar rule names in the upcoming language release - there isn't time to think slangs through enough, or those names - and so it's tempting to leave the_s to shout "still guts!". However, the pragmatic answer may well be to just do it on the RakuAST switch, since everyone with a module dabbling in that area is going to have to fix it on the RakuAST transition anyway. I won't promise not to break them again when we do slangs properly, but at least it stands a chance of lessening the impact then.