Rename std.string.toStringz?
alphabeta
alpha at beta.com
Sat Jun 18 07:32:41 PDT 2011
On 18/06/11 11:30 PM, Ali Çehreli wrote:
> On Sat, 18 Jun 2011 02:59:07 -0700, Jonathan M Davis wrote:
>
>> toWStringz to match toStringz
>
> That's amusing. :) toString is a name that morphs the type name (string -
>> String) due to following an insufficient naming standard adamantly. In
> a perfect world the name of the function should be to_string (or
> fortunately to!string in D's case).
>
> Although this naming standard produces that broken name, we stop
> following it when producing the name of a sister function. The logic that
> produced toString should insist on toWstring. :p (Or perhaps we are
> implying that wstring should be wString or WString to begin with?)
>
> I humbly recommend that we put some more engineering in programming in
> general but at least when naming. Camel casing is broken as it produces
> the same name for two separate types:
>
> string -> toString
> String -> toString
>
> I know it's too late for toString but it should be fine to use
> underscores where camel casing doesn't work:
>
> string -> to_string
> String -> to_String
>
> Ali
This is a good observation, namely
> string -> toString
> String -> toString
The same situation arises when trying to CamelCase acronyms.
In aerospace/defence domains that I have worked in, such ambiguities are
not allowed and the use of acronyms in code identifiers must be
delineated with underscores. I can't think of a really good mal-example
right now but I'm sure others have tripped up on this issue before in
much less than moon-shot projects.
ab
More information about the Digitalmars-d
mailing list