"Matthew Wilson" <matthew@stlsoft.org> wrote in message
news:bkgonn$4ln$1@digitaldaemon.com...
"Sean L. Palmer" <palmer.sean@verizon.net> wrote in message
news:bkgnhd$th$1@digitaldaemon.com...
I do think D needs to decide on a naming convention for builtins and
standard library. I think it needs to happen very very soon.
Absolutely. I think
1. Modules:
c.stdio
c.win32
d.win32.registry
Only because there's so much momentum built up around it already.
2. Classes:
KeySequence
File
I do this, but I'm constantly bummed that the style is different for
builtins than for my classes and typedefs:
int
float
Int32
UInt32 // or Uint32?
Vector3
Matrix4x4
It ends up making me want to make every identifier initial lowercase
mixed-case.
3. Free functions:
<no bloody idea! clearly things in c.stdio are going to be
lowercase. Things in c.win32 are not (e.g. RegCreateKeyExA). I would
prefer
to write free functions as Api_SomeFunction, but I can live with pretty
much
any convention. >
No, that's what modules are for. Why redundantly put the api name into the
function name? Just import the module as needing explicit qualification.
4. Methods:
CreateSubKey
5. Properties:
Values
OpenFiles
6. Variables:
someVariable
<and the odd, bIfOpen, thrown in!! Ha ha>
7. Enums - yikes
thisway or
this_way or
ThisWay or
THIS_WAY
Yah... my enums look more like values. Variables, constants, and
enumerants, all initial lowercase.
As far as I can tell
1. is already happening. There's been the odd mention of "D.Xyz.Abc" but I
think Walter's already sailed this ship with c.stdio. It would be
ludicrous
to have "c.*" and "D.*". There's nothing stopping 3rd parties from having
uppercase it they wish. Jaba uses all lowercase for the standard libs, and
most vendors do too, but some use upper (IIRC).
Jabba? Java the Hutt? It is kinda bloated! harhar
2. seems to be the way everyone writes code, so not in the least
contentious
3. the "c.*" functions are already set. We have no choice but to follow
whatever naming convention for any C-libs we link to, unless someone wants
to go to the paitful and pointless effort of wrapping them. (Bags not me!)
I've not noticed many people talking about free functions otherwise. (I do
hope we've all not been seduced by the everything is an object bullshit.
Sigh).
4. Pretty much all code I've seen posted does this, so shouldn't be a
prob.
However, I think a most of Phobos code uses lowercase ...
I just did a grep, and it appears that most, but not all, of Phobos uses
lower. I think this chews, but can live with it for the moment for the
same
reason that it's useful in C++, to disambiguate standard library / STL
stuff
from "proper" code.
This is going to be a pain in the future, methinks.
5. I guess these are too new to tell.
6. I've not seen any uppercase variable names, thank goodness!
7. We need some opinions on this asap. I've used both ThisWay and
THIS_WAY,
so I'm a hypocrite. Since we don't need to reserve all uppercase for the
preprocessor, I'd like to use uppercase for constants and enum names /
variables, but recognise this may not be popular. Lots of opinions please
...
I think all uppercase is ugly, and not only that, it forces you to use
underscores to separate the words, which I also dislike.
I think of the variable/method/class separation more of like
value/function/type. Currently, for me, functions are capitalized like
types. This sorta makes sense when you think about typecasting, which is a
function.
MyType(x)
I'm really starting to like the rule case is insignificant unless the
identifier is only one character, in which case it is significant. That way
you can have A and a. Or maybe as a more general single rule, case is
significant for the first character of an identifier, and insignificant for
the rest. That way you can have Foo and foo, but FOO is the same as Foo,
and fOO is the same as foo. people don't have to worry about memorizing the
case of the rest of the identifier, which is what most people disagree on
most anyway.
I don't really care what style the library is written in... I just don't
like to have to switch styles when I am dealing with different libraries.
If you're using 3 libraries you have to mix 3 different styles, plus your
own style. That's a lot to remember.
Sean
I'd also like it if the _ was optional, although I know that's never
going to happen.