Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Gene Wirchenko Newsgroups: comp.lang.java.programmer Subject: Re: CLI Java Glitch Date: Thu, 23 Jun 2011 08:58:54 -0700 Organization: A noiseless patient Spider Lines: 60 Message-ID: <2do60713no4mvf4t8elsppdt5qcpmidlcj@4ax.com> References: <4dffe2ea$0$57121$c30e37c6@exi-reader.telstra.net> <96dvubFalpU1@mid.individual.net> <3qOdnSBTduuqsp_TnZ2dnUVZ_rOdnZ2d@earthlink.com> <7sd407hclqd092brj1cgqmlk4r129bcqb4@4ax.com> <3qh407te4dp4l40kqrlgt6vsi636rs8qqd@4ax.com> <96h0ivFhakU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: mx04.eternal-september.org; posting-host="7Qrvczazr82YckO5XW8Vtw"; logging-data="29639"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19N1jXwDjFeHSjwXpr244IH0h8oOZiVam8=" X-Newsreader: Forte Agent 4.2/32.1118 Cancel-Lock: sha1:3fofpXTDFihQha8kcJ2pHrhXubk= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5577 On Thu, 23 Jun 2011 15:23:26 +0100, Nigel Wade wrote: >On 22/06/11 20:50, Gene Wirchenko wrote: >> On 22 Jun 2011 19:45:02 GMT, ram@zedat.fu-berlin.de (Stefan Ram) >> wrote: >> >> [snip] >> >>> Programmers usually are grateful to get error reports as >>> soon as possible. >> >> We are even more grateful not to have something flagged as an >> error when it is not, or when it need not be. > >But in your original post it is an error. Java is case-sensitive and the >class you asked for does not exist. Therefore it has to be flagged as an >error. > >If Java were to start guessing what you might have intended anarchy >would result. What if you wanted to run your class called deletefiles I have already posted a solution. It is not anarchy. On a case-insensitive filesystem: search for filename How many? 0: throw not found 1: run it regardless of case 2+: Is one of them a case match? Yes: run that one No: throw ambiguous name >(which prompts you before deleting any files), but Java wasn't able to >find that because you'd got your classpath wrong, or for some other >reason. But it did find a class called DeleteFiles (a similar class, but >it deletes everything without asking) so ran that for you instead. What See above. That would be ambiguous. I had not thought of the path, but would not mind seeing a slightly longer startup by running through all of the directories. Run the first exact case match if there is one. If not, run the first match in a directory. If there is more than one case-insensitive match in a directory, throw an error. >if the class it found had different constructors, or methods, and your >code crashed in strange and wonderful ways? Would you still think that >randomly substituting a class for something which was superficially >similar in name was a good idea? It is not randomly substituting, just disregarding case. >Sloppy user thinking should not be encouraged. Whilst it may make the >user's life a little easier in some cases, that small benefit is grossly >outweighed when it blows up in their face Boy, do you ever exaggerate to make your case. Sincerely, Gene Wirchenko