Post Reply 
Saving expressions?
03-21-2020, 02:40 PM
Post: #7
RE: Saving expressions?
(03-21-2020 12:32 PM)CyberAngel Wrote:  
(03-21-2020 10:47 AM)toml_12953 Wrote:  IMHO, that's one of the deficiencies of the Prime. I'd like complete freedom on deciding what goes under what variable name. There's no such restriction in C, Python, Pascal, BASIC, COBOL, FORTRAN, etc. FORTRAN does have a default of INTEGER for some variables but you can override it.

Pascal restricts the type forever.
There's no such restrictions on HP Prime where you can freely reassign a free variable with your choice of content at any moment.
In COBOL one can do even better and overlap variables at will. Diaster waiting if your compiler can't handle it.
Fortran is (was?) quite restricted.

Pascal and C only restrict the type after you define a variable. You can use almost any letter or combination of letters you want. Defining the datatype ahead of time is considered good programming practice.

The ANSI/ISO standard for COBOL allows overlap of variables. Any standard-compliant compiler can handle it (almost all current compilers from mainframes to micros)

How is FORTRAN restricted? The default for variables starting with the letters I - N is integer but you can redefine them if you want. FORTRAN 90 only has these restrictions:

A variable name must start with an letter.
After that, the rest of the name can contain only letters (a-z), digits (0-9) or underscore.
A variable name can be no longer than 31 characters.

These don't seem like onerous restrictions to me. To be able to change the datatype stored in a variable at will isn't good programming practice. The increased flexibility is more than offset by the potential for errors.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Saving expressions? - Dands - 03-20-2020, 07:15 PM
RE: Saving expressions? - CyberAngel - 03-20-2020, 09:40 PM
RE: Saving expressions? - victorvbc - 03-21-2020, 03:30 AM
RE: Saving expressions? - Dands - 03-21-2020, 04:19 AM
RE: Saving expressions? - toml_12953 - 03-21-2020, 10:47 AM
RE: Saving expressions? - CyberAngel - 03-21-2020, 12:32 PM
RE: Saving expressions? - toml_12953 - 03-21-2020 02:40 PM
RE: Saving expressions? - CyberAngel - 03-21-2020, 04:38 PM
RE: Saving expressions? - Dands - 03-21-2020, 04:58 PM
RE: Saving expressions? - CyberAngel - 03-21-2020, 05:23 PM
RE: Saving expressions? - victorvbc - 03-21-2020, 06:48 PM
RE: Saving expressions? - Dands - 03-21-2020, 08:18 PM
RE: Saving expressions? - toml_12953 - 03-21-2020, 08:26 PM



User(s) browsing this thread: 1 Guest(s)