type Age = 0..150;
type Age = [0..150];
It is a pity that has taken so many years for people to start appreciating type driven design. type Age = 0..150;
type Age = [0..150];
It is a pity that has taken so many years for people to start appreciating type driven design. TYPE
TWeekday = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,
Sunday);
VAR
WeekdayNameIndex : ARRAY [TWeekday] OF ShortString = ('Mon', 'Tue',
'Wed', 'Thu', 'Fri', 'Sat', 'Sun');
Now `WeekdayNameIndex` is a properly type- and range-checked look-up table.It's really sad that these simple joys of Pascal are still lacking from a lot of mainstream languages.
Ada has this as well, including using any arbitrary continuous range for array indexing which handles remapping indices for you. e.g. if the key range is 20-40 the language handles associating it with array indices for you.
Funnily enough though, I took a basic computer science course back in 1995 where Pascal was the first language that was taught! I still remember the instructor telling us to imagine how we would instruct an alien how to use a vending machine, we could not assume it knew anything and had to lay out each logical step and it would do exactly as we told it, so we better get it right. He said that was the mindset we needed for programming.
Fast-forward to 2004 when I resumed my further education and now the first language taught in that university was Visual Basic, followed by Java for the object-oriented programming class and then straight into pure C for Operating Systems which was a bit of a jolt. Oh, and then back to Java when we had some horrible UML class with design software that auto generated code.
Apologies for the off-topic meandering, the mention of Pascal brought back memories!
1) It made you really think about the ideas. Sometimes it revealed misunderstandings in the requirements gathering or translation. That was the optimal time to find problems in the recspec and bounce them back before it got too late.
2) One you get moving in a very strongly typed language the rate of serious obstacles falls off rapidly. It really does pay yo do the work up front. I think of it as having to tidy up your room before you're allowed to play.
Appolo, Lisa and Mac OS were originally written in Pascal.
Apple's Object Pascal was adopted by Borland and left its mark in the PC computing world, still present to this day in Delphi and Free Pascal.
The MS-DOS Demoscene had mostly Turbo Pascal as companion to the otherwise Assembly written demos.
One really needs to be deep into caring about security to learn Ada, due to how costly getting access to a compiler was during the last century, before GNAT came to be.
I had the books and no compilers to actually write the code on.
They also sold MS Fortran and MS Lisp.
1980s Microsoft Lisp was just reselling Soft Warehouse muLISP, minus the compiler. In 1999, Soft Warehouse was purchased by Texas Instruments. Microsoft also resold their computer algebra system, muMATH which was built on top of muSIMP (muLISP with an Algol-like syntax)
MS Fortran, by contrast, I believe was always an in-house Microsoft-developed product. So originally was Microsoft COBOL versions 1 and 2, but version 3 onwards was rebadged MicroFocus COBOL
I am happy to contribute to your off topic meandering.