death to case sensitivity !

Started by meems, February 28, 2018, 20:31:37

Previous topic - Next topic

meems

So this follows a post by iWasAdam about case sensitive languages
Thought it deserved its own thread.

Quotevariable would be used within a function/method and would probably be local
Variable could be a function or global within a class
VARIABLE would usually be a const or static of some form - generally predefined elsewhere
_variable / _Variable usually internal class stuff

So Variable would be the access point for the internal _variable class definitions

vArIAble, variABLE are just dumb and are sackable offenses  :P

In essence (on the surface) they all are the same, but in practice there is a general programming method to naming.

Where this becomes more important is with the following sort of stuff
PageCoreTileNum.Value is far more readable than pagecoretilenum.Value and is easier to read (quickly) than Page_Core_Tile_Num.Value where the _ sort of breaks up the flow

Whereas
KEYPRESS_M
STORM_FOUNTAIN
MOVEMENT_LEFT

becomes easier to read and instantly recognisable as some form of static/const that is pre-defined

There are other notations which have the base type also added. E.G.
fX = float value X
iX = int value X
bX = bool value X
strX =string value of X

Again this sort of use allows someone else to instantly look at the code and know what is going on without resorting to finding header files, etc.

I agree with the rational for case sensitivity, it is a good idea to store info in names of variables for easier understanding.
But making the programmer do the case sensitivity is exactly the wrong implementation of this rational.
Are you aware there has been a different approach? One that is at least as old?
Here's a clue from 1991

Blitz2 on the amiga. Nothing special about the case sensitive style. Most languages do it then and now. The letter-case of the terms are auto adjusted by the ide. They are also auto coloured by the ide. This the correct approach to case-sensitivity. The ide should do the legwork, not the programmer.
Many programmers believe that languages that don't require the programmer to do the case sensitive legwork aren't case sensitive, even though the ide's of these non-case-sensitive languages are strict about keywords starting with a capital letter.
Well, such an opinion isn't  totally wrong, its an over generalization of the fact that variable names aren't case sensitive in so-called case insensitive languages.

But in the modern guise of case sensitivity, we aren't focused on just variables. The programmer is expected to do the legwork of capital first letters for functions and methods, and all caps for constants.

solution: extend the auto correct usually reserved for keywords to all words.
there should be a philosophy of minimizing the need for the programmer to work the case sensitivity
the ide should pick up on new terms introduced by the programmer and auto correct the letter case. Once a new term is declared, all other case variations of it become unavailable.
e.g
A new variable is declared, the ide will auto correct to always be in lowercase
A new constant -> ide always autocorrects to uppercase
new function\method -> ide autocorrects 1st letter uppercase
for multi word terms that punctuate each word with a cap, the ide can follow the user's caps at the declaration\definition of the term.

simple, and it would be absolutely great. Which ever language programmer implements this into his language deserves a statue in silicon valley.
Leave you with this final thought. Imagine all those times in blitz, on the amiga, on the PC in 2000, in blitz3D, in blitzmax, and many other languages. Imagine if every time you made a for -next loop, or a while loop, or any other key command, you had to do your own capital 1st letter. Fuuuuuuu. what a pain. Now realise this is the reality you've accepted for many languages. Including cerebus. argh. plz. no.
It shouldn't have been, but I can't pretend, case sensitivity was a significant factor in my decision to not to use cerebus.

What you think? Even though i feel strongly about it now, I leave room to believe I'm wrong. I'm interested to know if programmers seriously tried to go down this road, but found it impractical.

Steve Elliott

Quote
The ide should do the legwork, not the programmer.

I totally disagree with this statement.  That means the IDE is correcting a flaw in the design of the computer language.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Derron

IDEs do the "beautifying" - like autocapitalization, or maybe "unifying" variable names (you declared "mySuperVar", and the IDE corrects follow-up variations like "mySUPERvar" to "mySuperVar").

The language itself should be not case-sensitive. It also should not allow "non ascii-chars" (and even there, not all) in variables - to avoid ambiguity and it eases the pain for newcomers to a language.


bye
Ron

therevills

I'm in the pro case sensitivity group  :P

It forces consistency and in programming that is super important.

The "main" programming languages are case sensitive:  C, C++, Java, C# where as most beginner languages are not... there is a reason for it  :)

meems

@steve
so u think the vast majority of languages and their ide's are wrong on this. It pains me to have to do caps for keywords. But it pains you everytime your ide autocorrects your keywords e.g. ( For While Function )? Do you type the cap yourself even though the ide would have done it for u?

@therevills
>I'm in the pro case sensitivity group
so am i. I just think the ide should do it. Not the programmer.

>The "main" programming languages are case sensitive: ... there is a reason for it
Yes because they're all dumb, and following each others wrong lead in a circle of dumb sheep. plus they are very set in their ways, they can't change now.

Its abit crazy that both approaches are implemented into modern languages, both ide auto corrects for some arbitrary keywords but not all, and programmer has to do the others, ones that have been put in a non-core module so don't get the accolade of being an ide auto corrected term.

Steve Elliott

#5
@meems
I just re-designed the language instead.

Quote
I'm in the pro case sensitivity group.

It forces consistency

It clearly doesn't.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

meems

>I just re-designed the language instead.
Great! Show us with a before and after re-design. Color me skeptical until u do though. I find it hard to believe u've hacked into blitz and other languages to stop the ide from recognizing key words.


>It clearly doesn't [force consistancy].
Its not clear to me. give example of it not forcing consistency plz.

Derron

Quote from: meems on February 28, 2018, 22:03:40
Its not clear to me. give example of it not forcing consistency plz.

String mySupERVAR
String myOtherVar
String mylowercasevar

The consistency is just that variations of the casing will create new variables (or errors for nonexisting ones). But it does not enforce you to use "lower Camel Case" or something else which creates "visual" consistency (except for eg. first character needs to be Upper-case or so).

bye
Ron

therevills

#8
Bad code is bad code and can be created in any language.

A case sensitive language with a good coding standard will force consistency, if one programmer calls a variable "myFieldAdapter" then all other programmers will have to use that variable in that form.

meems

well any case sensitive language that doesn't require the user to explicitly declare variables is just asking for a rash of totally avoidable runtime bugs. What languages are like this? I generously assume that no such language exists these days. iirc java used to have implicit declaration, so if you got your caps wrong you only found out when your program acted weird. Haven't they fixed that shit yet?

therevills

Quote from: meems on February 28, 2018, 22:30:45
well any case sensitive language that doesn't require the user to explicitly declare variables is just asking for a rash of totally avoidable runtime bugs. What languages are like this?

Main one is is JavaScript (nothing to do with Java)... its case sensitive and dynamic.

Derron

@ meems
use PHP and you are able to use undeclared variables.
use Javascript and undeclared variables are handled as globals.
...

@ good coding standards
Feel free to have them in a case-insensitive language too. It is up to you to keep conform with them. And if you have a good IDE (sorry BRL-languages ;-)) then it would allow you to auto-format according to the initial definition of the variable, function name (talking about the casing).


Case-sensitivity is nearly as "odd" as the intentation-interpretation of Python.

bye
Ron

Steve Elliott

@meems
I wasn't talking about a Blitz Language.  Something for the near future.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

therevills

Quote from: Derron on February 28, 2018, 22:37:08
@ good coding standards
Feel free to have them in a case-insensitive language too. It is up to you to keep conform with them.

Yep we do. In my current job, the GUI is a Java Swing application with an Oracle PLSQL backend. PLSQL is case-insensitive and we have peer reviews in place to ensure everyone confirms to the strict coding standards (as well as making sure the code makes sense).

meems

Quoteuse PHP and you are able to use undeclared variables.
use Javascript and undeclared variables are handled as globals.

the absolute state of programming languages in 2018. should have been fixed in the 80's.

@steve
well make sure it implements my awesome idea of automated caps corrector for all terms and not your rubbish idea of no word recognition. you will secure your place in silicon heaven

I'm getting the impression that no language has ever done my awesome idea. I knew i was good, but i didn't realize how good. Am i really that good?