Thread overview | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 20, 2003 Naming conventions | ||||
---|---|---|---|---|
| ||||
Any chance on our standardising on lowercase for modules, and UpperCase for Classes? (Naturally there'd be exceptions, such as c.stdio.) If not, I'd be interested to hear of suggestions for a good convention. For example, I don't think many would suggest that having the same name and capitalisation for a module and a class (e.g. the module "d.win32.registry" and the class "registry") is a good thing. |
September 20, 2003 Re: Naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | > example, I don't think many would suggest that having the same name and capitalisation for a module and a class (e.g. the module "d.win32.registry" > and the class "registry") is a good thing. Why not? Module and classes are conceptualy the same thing (another name scope) and work pretty much the same (except for instantiation). I vote for MixedCase convention for modules and classes and lowerUpperCase for methods, types and variables. Keywords already use lowerUpperCase and that provides lots of conflicts: import win32.module; That's my opinion but i'll use whatever is decided here anyway. Cheers. |
September 20, 2003 Re: Naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Julio César Carrascal Urquijo | "Julio César Carrascal Urquijo" <adnoctum@phreaker.net> wrote in message news:bkgk1j$2mtv$2@digitaldaemon.com... > > example, I don't think many would suggest that having the same name and capitalisation for a module and a class (e.g. the module > "d.win32.registry" > > and the class "registry") is a good thing. > > Why not? Module and classes are conceptualy the same thing (another name > scope) and work pretty much the same (except for instantiation). How are modules and classes the same thing. I've heard this many times within C++, but I just can't see it. Persuade me (if you can!). > I vote for MixedCase convention for modules and classes and lowerUpperCase for methods, types and variables. Sorry. Strongly disagree. What's the virtue in not being able to distinguish between methods/types and variables? lowerUpperCase should be only for variables. > Keywords already use lowerUpperCase and that provides lots of conflicts: > > import win32.module; That's a fair point. I doubt anyone else'll ever be persuaded to have uppercase keywords, though. > That's my opinion but i'll use whatever is decided here anyway. Well, there's not a single perfect answer, simple because there are only two cases, and a limited number of ways of mixing those cases. As we've just seen, two people have radically disagreed about two things. Heaven knows how many opinions there'll be once a few more jump in. |
September 20, 2003 Re: Naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | The problem with making all classes initial caps is that all the builtin types are all lowercase. This effort is doomed to failure. Sean "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bkghl9$2ene$1@digitaldaemon.com... > Any chance on our standardising on lowercase for modules, and UpperCase for > Classes? (Naturally there'd be exceptions, such as c.stdio.) > > If not, I'd be interested to hear of suggestions for a good convention. For > example, I don't think many would suggest that having the same name and capitalisation for a module and a class (e.g. the module "d.win32.registry" > and the class "registry") is a good thing. |
September 20, 2003 Re: Naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | > The problem with making all classes initial caps is that all the builtin types are all lowercase. That's true. However, since they're built-in, that does not present too much of a problem. > This effort is doomed to failure. Notwithstanding my previous comment, you are correct here. Human nature is what it is. I guess I'm seeking just to test the waters such that there's enough people that can live with what I do with the registry library so that I won't be "asked" to revise the naming. > Sean > > "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bkghl9$2ene$1@digitaldaemon.com... > > Any chance on our standardising on lowercase for modules, and UpperCase > for > > Classes? (Naturally there'd be exceptions, such as c.stdio.) > > > > If not, I'd be interested to hear of suggestions for a good convention. > For > > example, I don't think many would suggest that having the same name and capitalisation for a module and a class (e.g. the module > "d.win32.registry" > > and the class "registry") is a good thing. > > |
September 20, 2003 Re: Naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bkgkvc$2qv4$1@digitaldaemon.com... > > "Julio César Carrascal Urquijo" <adnoctum@phreaker.net> wrote in message news:bkgk1j$2mtv$2@digitaldaemon.com... > > > example, I don't think many would suggest that having the same name and > > > capitalisation for a module and a class (e.g. the module > > "d.win32.registry" > > > and the class "registry") is a good thing. > > > > Why not? Module and classes are conceptualy the same thing (another name > > scope) and work pretty much the same (except for instantiation). > > How are modules and classes the same thing. I've heard this many times within C++, but I just can't see it. Persuade me (if you can!). A module is a class that is all static. It's as close as you can get to a singleton as there is. > > I vote for MixedCase convention for modules and classes and lowerUpperCase > > for methods, types and variables. > > Sorry. Strongly disagree. What's the virtue in not being able to distinguish > between methods/types and variables? lowerUpperCase should be only for variables. I use this style. > > Keywords already use lowerUpperCase and that provides lots of conflicts: > > > > import win32.module; > > That's a fair point. I doubt anyone else'll ever be persuaded to have uppercase keywords, though. What if the identifiers were not case sensitive, unless they were single letter identifiers? > > That's my opinion but i'll use whatever is decided here anyway. > > Well, there's not a single perfect answer, simple because there are only two > cases, and a limited number of ways of mixing those cases. As we've just seen, two people have radically disagreed about two things. Heaven knows how > many opinions there'll be once a few more jump in. Wheeee!!! Sean |
September 20, 2003 Re: Naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | Why didn't you say so? ;) 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. I do not think you can force everybody else to use the same convention (except when interfacing with the standard library of course) nor is it possible to come up with a convention that everybody is happy with. Sean "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bkgm88$2ugv$1@digitaldaemon.com... > > > The problem with making all classes initial caps is that all the builtin types are all lowercase. > > That's true. However, since they're built-in, that does not present too much > of a problem. > > > This effort is doomed to failure. > > Notwithstanding my previous comment, you are correct here. Human nature is what it is. I guess I'm seeking just to test the waters such that there's enough people that can live with what I do with the registry library so that > I won't be "asked" to revise the naming. |
September 20, 2003 Re: Naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | "Sean L. Palmer" <palmer.sean@verizon.net> wrote in message news:bkgnhd$th$1@digitaldaemon.com... > Why didn't you say so? ;) Asked and answered (well, winked, anyway) > 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 2. Classes: KeySequence File 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. > 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 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). 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 do not think you can force everybody else to use the same convention (except when interfacing with the standard library of course) nor is it possible to come up with a convention that everybody is happy with. > > Sean > > "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bkgm88$2ugv$1@digitaldaemon.com... > > > > > The problem with making all classes initial caps is that all the builtin > > > types are all lowercase. > > > > That's true. However, since they're built-in, that does not present too > much > > of a problem. > > > > > This effort is doomed to failure. > > > > Notwithstanding my previous comment, you are correct here. Human nature is > > what it is. I guess I'm seeking just to test the waters such that there's > > enough people that can live with what I do with the registry library so > that > > I won't be "asked" to revise the naming. > > > |
September 20, 2003 Re: Naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | "Sean L. Palmer" wrote: > > The problem with making all classes initial caps is that all the builtin types are all lowercase. But doesn't this make a nice distiction between primitives and classes? -- Helmut Leitner leitner@hls.via.at Graz, Austria www.hls-software.com |
September 20, 2003 Re: Naming conventions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bkgkvc$2qv4$1@digitaldaemon.com... > > I vote for MixedCase convention for modules and classes and lowerUpperCase > > for methods, types and variables. > > Sorry. Strongly disagree. What's the virtue in not being able to distinguish > between methods/types and variables? lowerUpperCase should be only for variables. Actually, I think lowerUpperCase should also be used for methods (not types, though). Method calls are immediately recognizable by the brackets that follow them. I'd rather save pure UpperCase for classes only. And besides: in D the difference between methods and variables is starting to vanish with the new gettor and settor methods. One more reason why they should be named in a similar way. May I suggest another radical thing (I hope I'm not getting banned for this ;))? How about CClass, IInterface and TTemplateClass? I know that many people see it as too Microsoft-ish, but I have found it useful in the past to be able to easily distingusih interfaces, classes and template classes. They are all used in a different way. For example, templates are instantiated in a different way than simple classes (needing template parameters) and interfaces cannot be instantiated at all. Hmmm. I don't have much experience with D structs, but maybe it is also a good idea to name them differently than classes? Depends on wether their differences really cause them to be used in distinguished ways. Hauke |
Copyright © 1999-2021 by the D Language Foundation