News for hackers. Stuff that matters.
Re:Deconstructing the DAO Attack: A Brief Code Tour by rbobby on Saturday June 18, 2016 @05:55PM (#11930790)
Case sensitivity in any programming language is crazy. I can't for the life of me see a valid engineering principal that accepts IsTheOne() and istheone() being different bits of code. Oh sure at a technical level the computer has no problem with... the problem is restricted to those oh so error prone humans.

Can anyone here honestly say that if they were doing a code review they'd agree that solely a difference in case would get their approval?

And don't even get me started on filenames that only differ by case. If that's a good idea then I think trailing whitespace should be significant too!!!

Re:Deconstructing the DAO Attack: A Brief Code Tour by pmontra on Sunday June 19, 2016 @04:33AM (#11932271)
There are languages that use lowercased names for constants (Erlang's atoms) and uppercased Names for variables, which are immutable and quasi constants anyway. This is uncommon but many other languages use uppercase for classes (Person) and lowercase for variables such as Person person = new Person(). That last example is one reson for having case sensitive languages. I can't think of any language I used in the last 30 years that was case insensitive. Maybe some BASIC interpreters on home computers in the 80s? But not all of them had upper and lower case characters to start with.

Linux has a notoriously case sensitive file system, with trailing significant spaces (they are not special characters). Mac and Windows also have case sensitive file systems but that feature is turned off by default.

Re:Deconstructing the DAO Attack: A Brief Code Tour by kartickv on Saturday June 18, 2016 @10:59PM (#11931621)
I don't know why you've been downvoted, but anyone who disagrees with you needs to explain in what situation it would make sense to have two different functions or files with names differing only in case.

I upvoted you.

Re:Deconstructing the DAO Attack: A Brief Code Tour by wnewman on Sunday June 19, 2016 @11:42AM (#11933323)
I have used all-uppercase to make a distinction like class vs. instance in variables (in case-sensitive languages in which the class might be an ordinary held-in-a-variable value, like Javascript), and I might do it again. But it's very unusual, and it's also the kind of practice that is more suitable for a 1KLOC project that will receive 100 hours of effort from a single maintainer over its lifetime than for a bigger project with many maintainers and a highly motivated community of attackers.

I don't think there was ever a case when I was tempted to name two functions with different cases, but if I ever had to write a modest-sized 1-maintainer system in which many functions came in exactly two different flavors, I might be tempted. (Perhaps threadsafe locked vs. raw? or some C++-like distinction between raw functions and closure-like class instances which can be used in a function-call context? or raw functions vs. wrappers with the extra plumbing required to let them be invoked from a scripting language?)

afterthought: And now that I think of it, in old C code I think I vaguely remember working with macro vs. function implementations of the same operation distinguished by capitalizing the name, and I don't think the name convention was an urgent problem. C macros can breed various errors, but I think bitbang_macro vs. bitbang would breed pretty much the same errors as BITBANG vs. bitbang.

Re:Deconstructing the DAO Attack: A Brief Code Tour by kartickv on Sunday June 19, 2016 @11:42PM (#11935925)
In those situations, it would have been much more readable to have classFoo vs foo, foo() vs nonThreadSafeFoo(), etc.

The bigger point is that while you can come up with creative ways to take advantage of case-sensitivity, it's not that you would have missed it if the language was case-insensitive. From that point of view, case-sensitivity has no benefit, but only a cost: leads to irritating errors from the compiler, or runtime errors in dynamically typed languages.

If something has no benefit, and only a cost, we should get rid of it.

Re:Deconstructing the DAO Attack: A Brief Code Tour by astrobe_ on Sunday June 19, 2016 @01:43PM (#11933799)
It's not that it would make sense. It is more like it is the programmer's fault.

Next week's stupid but expensive typo will be received() instead of receive(). What will you demand then? That the compiler refuses names based on the Levenshtein distance?

It's the job of a style checking tool, not the job of the compiler.

Re:Deconstructing the DAO Attack: A Brief Code Tour by kartickv on Sunday June 19, 2016 @11:35PM (#11935902)
That's a false analogy.

Saying it's the programmer's fault is another circular argument. It is, only in languages that make it the programmer's fault, but I would say that it's actually the language designers' fault.

Re:Deconstructing the DAO Attack: A Brief Code Tour by jsprogrammer on Saturday June 18, 2016 @05:58PM (#11930801)
IsTheOne() and istheone() are different bits of code.
Re:Deconstructing the DAO Attack: A Brief Code Tour by kartickv on Saturday June 18, 2016 @11:15PM (#11931656)
That's a circular argument. They are different only because the language says they are different, while the post you've responded to says (correctly) that that's bad language design.
Re:Deconstructing the DAO Attack: A Brief Code Tour by jsprogrammer on Saturday June 18, 2016 @11:43PM (#11931695)
The bit representation is different.
Re:Deconstructing the DAO Attack: A Brief Code Tour by kartickv on Sunday June 19, 2016 @12:00AM (#11931724)
Which is irrelevant, since languages are a medium of human expression, not a way to store bits on the disk.
Re:Deconstructing the DAO Attack: A Brief Code Tour by jsprogrammer on Sunday June 19, 2016 @12:33AM (#11931782)
Irrelevant to what? The two words literally are represented with different bits (code).
Re:Deconstructing the DAO Attack: A Brief Code Tour by baby on Monday June 20, 2016 @02:17PM (#11939971)
Assuming you are not trolling: yes they are indeed represented with different bits, which doesn't matter since these bits are not the bits executed by the CPU in the end. The "words" and not the bits are interpreted or compiled into machine code. Which is where bits matter.
Re:Deconstructing the DAO Attack: A Brief Code Tour by roblev on Sunday June 19, 2016 @04:23PM (#11934504)
clearly case sensitivity is a decision by the language designers. Many languages are case-insensitive.

from https://en.wikipedia.org/wiki/Case_sensitivity

Some computer languages are case-sensitive for their identifiers (C, C++, Java, C#, Verilog, Ruby and XML). Others are case-insensitive (i.e., not case-sensitive), such as Ada, most BASICs (an exception being BBC BASIC), Fortran, SQL and Pascal.