Menu

Why the variable names are case-sensitive?

Serge
2017-03-28
2017-06-20
  • Serge

    Serge - 2017-03-28

    I have noticed that in BASIC-256 the variable names are case-sensitive but the keywords are not. Can someone explain this design decision?

     
  • Jim Reneau

    Jim Reneau - 2017-03-28

    Really, I am not sure of the history. That was the way it was when I started working on the code 7-8 years ago.

     
  • Florin Oprea

    Florin Oprea - 2017-03-28

    Wow! This is one of the best... :)

    Jim, I think Serge do not want to be impolite or to call somebody to account for.
    BASIC programming language it is in fact a case insensitive one.
    A kid should benefit from this advantage.

    The implementation is quite simple:
    In basicParse.y , in function int getSymbol(char *name) change this line:

    if (symtable[i] && !strcmp(name, symtable[i]))
    

    into

    if (symtable[i] && !strcasecmp(name, symtable[i]))
    

    Et voila! :)

    Respectfully,
    Florin Oprea

     
  • Serge

    Serge - 2017-03-31

    Florin, does 'strcasecmp' works under Windows? Some people say it does not. An to solve the problem they suggest something like that.

    #if defined(_WIN32) || defined(_WIN64)
      #define snprintf _snprintf
      #define vsnprintf _vsnprintf
      #define strcasecmp _stricmp
      #define strncasecmp _strnicmp
    #endif
    

    But that was not my question. The decision to make the variable names case-sensitive while the keywords are not case-sensitive looks strange to me. So I just asked if there is any explanation for that decision. And it seems that the answer is "no one cares".

     
  • Andras Kovacs

    Andras Kovacs - 2017-06-20

    Its better that te variable names are sensitive...
    for example we can use v as Variable and V[] as an array...

    This is a Basic for learning of programmig... we learn that te case can be sensitive :-)
    Also in C++ are Variables case sensitive.
    Also rigt that if the keywords are not case sensitive. We can learn that we use keyword only as keywords. All programming languages can be have his own individualities .

     
  • Florin Oprea

    Florin Oprea - 2017-06-20

    Fixed in version 1.99.99.76 (2017-04-02).
    Variable names are case-insensitive (just like keywords).

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.