Timeline for What negative consequences can arise from this language design rule?
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 19, 2014 at 15:23 | comment | added | supercat | @RoryHunter: Requiring that identifiers be written with the proper case, but requiring identifiers to be distinct in more that just case, would IMHO combine the advantages of case-sensitivity and case-insensitivity. If x is defined in an outer scope and X in an inner scope and a program tries to access x within that inner scope, a compiler that binds that to the outer scope or to the inner scope will yield unintended behavior a significant portion of the time. Better to require use of a different inner-scope name if the outer-scope variable should remain accessible. | |
| Mar 19, 2014 at 15:19 | comment | added | supercat | @RoryHunter: 1. Visible and usable; 2. Invisible, allowing the use of identifiers from outer scopes; 3. Obscuring, meaning that neither the identifier, nor any like-named identifer from outer scope should be usable. With regard to case sensitivity, I would like to see a language where, within a scope where Foo was defined, identifiers foo, FOO, or fOo, etc. would not be usable even if they were defined in an outer scope. Languages should not accept FOO as a synonym for Foo, but nor should they allow two identifiers to be used in the same scope that differ only by case. | |
| Mar 19, 2014 at 15:15 | comment | added | supercat | @RoryHunter: According to that page, local doesn't create a local variable, but merely makes changes to a global variable temporary. The idea with the temp var concept (not sure why temp var didn't show up--I'm pretty sure I typed it when I wrote the post) is that each such declaration creates a new local variable, but hides any other temp var of the same name in that scope, and blocks any further usage of a temp var of the same name in outer scope. BTW, a concept I think is important is that identifiers should have three degrees of visibility in any given scope: ... | |
| Mar 19, 2014 at 15:12 | history | edited | supercat | CC BY-SA 3.0 | Added `temp var` before `result` in last three assignments |
| Mar 19, 2014 at 10:50 | comment | added | Rory Hunter | Sounds a bit like local values in Perl - perldoc.perl.org/perlsub.html#Temporary-Values-via-local%28%29 | |
| Mar 18, 2014 at 22:07 | history | answered | supercat | CC BY-SA 3.0 |