Bug 3936 – Suggestions for some better alternative names
Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-03-12T06:23:00Z
Last change time
2016-10-14T01:28:48Z
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2010-03-12T06:23:03Z
In my mind (and in the mind of other programmers I know) a "byte" is an unsigned value. This has caused some bugs in my programs. So A better naming scheme can be "byte" and "sbyte" for the unsigned and signed bytes. But this is a exception to naming scheme of D types, and it can cause other bugs. So as compromise I think "ubyte" can be kept, but "byte" can be removed and replaced by "sbyte".
------------------
In future D programs immutability will probably become quite common. Annotating all not varying values in the code as "immutable" probably helps avoid some bugs too, it looks like a good programming practice. The term "immutable" is correct and readable, but it can be a little too much long. So it can be replaced by "val" (short for "value", as present in the Scala language).
------------------
I find not easy to remember the size of the "wchar" and "dchar" types: is something 'wide' wider than 'double'? But I don't have very good names to replace them. For example they can be renamed as "shortchar" (or "char16") for the 16 bits long, and "longchar" (or "char32") for the 32 bits long. The prefix short/long makes the length easy to remember. But they are long names.
Comment #1 by bearophile_hugs — 2010-03-25T11:47:18Z
"longchar" is a bad name, because it's not 64 bit long.
char32 (or even "intchar") are better.
Comment #2 by bearophile_hugs — 2010-03-26T07:57:17Z
Walter has refused the idea of changing wchar/dchar names.
(The "byte" ==> "sbyte" idea is in game still.)
Comment #3 by bearophile_hugs — 2010-03-31T07:58:46Z
"auto ref" suggests a name as "auto const" instead of "inout".
Or better "auto_ref" and "auto_const".