> -----Original Message----- > From: Peter Donald [mailto:[EMAIL PROTECTED]] > Sent: Saturday, January 05, 2002 9:53 PM > To: Jakarta General List > Subject: Re: More abuse of coding styles... > > > On Sun, 6 Jan 2002 11:26, Steve Downey wrote: > > Your javac has a configuration setting for the class names of inner > > classes? Although the inner classes use a $ embedded, > rather than as a lead > > character. It's a similar issue. > > And whats that got to do with the price of fish? $ is not valid in > identifiers in java language (but fine in .class file format). >
$ is a perfectly fine character in a java identifier. Even as the initial character. That's why it's specifically mentioned in the sun coding style guide. It's legal, but not meant for use by all. IOW: class $ { public int $() { int $ = 5; return $; } static public void main(String args[]) { $ dollar = new $(); System.out.println(dollar.$()); } } is legal. Ugly as hell. But legal. > > The recommendation in C that _ is reserved for the > implementor is not a > > linker issue, but more of a namespace scoping issue. > > errr .... go have a look at the evolution of c/linkers and > the pains some > people went through re different linker/header file combos. Been there, done that, have burn marks. The identifier name space starting with _ is reserved for implementors to provide such things as library functions with external linkage, used by the rest of the library, without running into conflicts with user declarations. The compiler is even entitled to emit calls to these functions, or reference these variables, without your direction. So if you name variables or functions things like _alloc, or _err, and your program crashes and burns, you've got no one to blame but yourself. > > > There isn't a good way > > of marking a function as to be used by the implementor or > the compiler, in > > such a way that a programmer can not conflict with it. Java > has private > > which accomplishes that. > > private is an access marker - it does not define any > metatype. Java has a > crap metadata infrastructure - thats one of the things that > C# did far better > than java. Its a feature people have been asking for since > 1.0 days but sun > keeps dropping the ball or implementing workarounds. > > > But reserving some characters for the implementors is not > really a bad > > thing. > > Sure it is - it makes it acceptable for them to write poor code. > In what way does it make it acceptable for them to write poor code? For example, the JSP spec reserves _jsp, jsp, _jspx and jspx for identifiers used in the classes generated by the page compiler. What other way do you propose to guarantee that the compiler won't generate names that conflict with ones I declare in a page? -SMD <><><><><><><><><><><><><><><><><><><><><>This electronic mail transmission may contain confidential information and is intended only for the person(s) named. Any use, copying or disclosure by any other person is strictly prohibited. If you have received this transmission in error, please notify the sender via e-mail. <><><><><><><><><><><><><><><><><><><><><> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>