November 27, 2020, 08:39:50 AM

Author Topic: death to case sensitivity !  (Read 7114 times)

Offline meems

  • Sr. Member
  • ****
  • Posts: 310
death to case sensitivity !
« on: February 28, 2018, 08:31:37 PM »
So this follows a post by iWasAdam about case sensitive languages
Thought it deserved its own thread.

Quote
variable 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.

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 2858
  • elgol 2021
Re: death to case sensitivity !
« Reply #1 on: February 28, 2018, 08:35:49 PM »
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.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, C64, ZX Spectrum Next.

Online Derron

  • Hero Member
  • *****
  • Posts: 3262
Re: death to case sensitivity !
« Reply #2 on: February 28, 2018, 08:57:24 PM »
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

Offline therevills

  • Hero Member
  • *****
  • Posts: 613
Re: death to case sensitivity !
« Reply #3 on: February 28, 2018, 08:59:20 PM »
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  :)

Offline meems

  • Sr. Member
  • ****
  • Posts: 310
Re: death to case sensitivity !
« Reply #4 on: February 28, 2018, 09:10:11 PM »
@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.

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 2858
  • elgol 2021
Re: death to case sensitivity !
« Reply #5 on: February 28, 2018, 09:44:09 PM »
@meems
I just re-designed the language instead.

Quote
I'm in the pro case sensitivity group.

It forces consistency

It clearly doesn't.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, C64, ZX Spectrum Next.

Offline meems

  • Sr. Member
  • ****
  • Posts: 310
Re: death to case sensitivity !
« Reply #6 on: February 28, 2018, 10:03:40 PM »
>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.

Online Derron

  • Hero Member
  • *****
  • Posts: 3262
Re: death to case sensitivity !
« Reply #7 on: February 28, 2018, 10:21:20 PM »
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

Offline therevills

  • Hero Member
  • *****
  • Posts: 613
Re: death to case sensitivity !
« Reply #8 on: February 28, 2018, 10:30:27 PM »
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.

Offline meems

  • Sr. Member
  • ****
  • Posts: 310
Re: death to case sensitivity !
« Reply #9 on: February 28, 2018, 10:30:45 PM »
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?

Offline therevills

  • Hero Member
  • *****
  • Posts: 613
Re: death to case sensitivity !
« Reply #10 on: February 28, 2018, 10:34:26 PM »
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.

Online Derron

  • Hero Member
  • *****
  • Posts: 3262
Re: death to case sensitivity !
« Reply #11 on: February 28, 2018, 10:37:08 PM »
@ 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

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 2858
  • elgol 2021
Re: death to case sensitivity !
« Reply #12 on: February 28, 2018, 10:37:24 PM »
@meems
I wasn't talking about a Blitz Language.  Something for the near future.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, C64, ZX Spectrum Next.

Offline therevills

  • Hero Member
  • *****
  • Posts: 613
Re: death to case sensitivity !
« Reply #13 on: February 28, 2018, 10:40:08 PM »
@ 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).

Offline meems

  • Sr. Member
  • ****
  • Posts: 310
Re: death to case sensitivity !
« Reply #14 on: February 28, 2018, 10:45:07 PM »
Quote
use 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?

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal