Old game show with computer

On “I’ve Got A Secret”, The secret was “I’m having my 1957 income tax figured out in 22 seconds” an “electronic brain”, as Gary Moore (the host) referred to it, was on stage. There also was a card reader and line printer. The guest was Mr. David Hemmes an IBM mathematician. Garry said it “was the first time that it has been officially done by machine”. It must be this episode.

S07E14 Douglas Fairbanks, Jr. Apr 2, 1958

I ripped it from an episode I had, and posted it on YouTube, because I couldn’t find the episode.

Further proof that I’m right about Pascal typed variables

Specifically pre-initializing arrays in the const section. Wasn’t even looking for this… honest. But I decided it’s probably best that I teach myself Pascal OOP, rather than listen to an instructor who is not particularly interested in doing things new ways… because it might break his code.

So I have this Pascal book in my collection, I thought I might look at to learn Pascal OOP…

And what do I read right in the beginning on Page 4? The author says use the {$J-} switch in all modern sources. Which I point out here, that Embarcadero recommends. I even used it (the long version) myself in the last image I showed.

However Huw recommends (in the course) that you pre-initialize arrays in the const section. So he edits his provided program. Then he adds the line “InitArray[2]:=’xxx’;” proving that you can still change it. My point was but it’s a constant and you shouldn’t be allowed to change it! So as you see below when I add the {$J-} switch that Embarcadero and now this author recommends. His example doesn’t work! In other words a const actually acts like a const. Imagine that!

All you have to do to make his code work in the above scenario is move the definition to the var section. Which I asked him several times “Is there any reason that you don’t move it there?” And he never really answered me.

I do it this way… damn it. You’re just a student. Don’t tell me there are better ways…I’ve been programming in Pascal since the mid 1980’s. Better… Schmetter.

The Udemy Lazarus instructor IS getting annoyed with me

After laying out my case. His response was “You have to remember that since I’ve been programming Pascal since the mid-80s and Delphi since its launch in 94, I have accumulated huge libraries of code, so I am not at all keen on breaking backward compatibility for the sake of incorporating new syntax“. Except it’s not new syntax the page I pointed him to was written in in 2013… 11 years ago. Also the course shouldn’t be about his code. It should be about teaching relatively current developments… IMHO. He could have responded “I wasn’t aware of that. Thanks for updating me”. But unfortunately some people just assume is someone takes a course they must be new to it.

A disagreement with the Udemy Lazarus instructor

In taking this course the instructor describes using “Typed constants” to pre-initialize arrays. These “constants” can later be changed. Well doesn’t that nullify the meaning of constants? So I took his example and moved the pre-initalized array out of the const section and moved it to the var section. As far as I could tell the results were exactly the same. Except now, if you later change the array it makes sense that it is allowed.

I think he got a little aggravated in me trying to make my point. Because at the end he say’s “Frankly, use whichever you want”. But I just couldn’t see why you would pre-initialize an array in the const section (which implies that you can’t change it later… but you can!) if you could do the same thing in the var section (which implies that you can change it later).

He went on to tell me to read page 63 of his book, where he say The way to do this… Not A way to do this!

He later said… “I would generally recommend declaring variables first and then initializing, and using typed consts when you need to pre-initialize“.

But as I show below you don’t need typed consts to pre-initialize an array.

This is what the official documentation for version 3.2.2 (the current version used with the current Lazarus version 3), says about Typed constants.

“Contrary to ordinary constants, a value can be assigned to them at run-time. This is an old concept from Turbo Pascal, WHICH HAS BEEN REPLACED WITH SUPPORT FOR INITIALIZED VARIABLES

Free Pascal itself says, Typed constants is an “is an old concept from Turbo Pascal” and has been replaced! here is an actual screenshot.


However as seen below you don’t need to use typed consts!

Below is his example… pre-initialize an array in the const section. As you can see he changed the 2nd array entry.

In this example I moved the the pre-initialized array to the var section. The results are the same.

Furthermore Free Pascal provides a compiler switch, called “$J or $WRITEABLECONST”. You can use it if you want a constant to act like a constant! As you can see below, with this switch off the compiler doesn’t allow you to change a constant.

My whole issue with the instructor was his attitude of Typed constants being The Way, to initialize arrays!

He also ended by saying “Typed constants have become widely used in Delphi, however, so when absolutely required I would occasionally use those”. However Embarcadero (the owners of Delphi) say “In early versions of Delphi and Object Pascal, typed constants were always writeable, corresponding to the {$J+} state. Old source code that uses writeable typed constants must be compiled in the {$J+} state, but for new applications it is recommended that you use initialized variables and compile your code in the {$J-} state.

Sorry, he’s probably forgotten more Pascal and Lazarus than I know. But in this case he’s wrong., I didn’t take the course to learn Pascal and Lazarus because I already was somewhat familiar with it, from teaching myself it, in the early and mid 2000s. I took the course for the OOP aspects which I’m admittedly weak in. I certainly don’t regret taking the course. And I would recommend it for people wanting to learn it.

Also it gets me coding in it again. I’m constantly forgetting the semicolon.

Sorry to beat a dead horse but this is what Wikipedia says…
const (computer programming)

In some programming languages, const is a type qualifier (a keyword applied to a data type) that indicates that the data is read-only.

Well it’s certainly not read only if you can change it!

It just makes no sense to initialize something in a const section… that you can later change!

version, -version or –version?

Why is there no standard. Whatever I guess is wrong. (Seems like 95% are --version)...
go version
hercules version (accepts all 3, but complains about the other 2)
fpc -version
ffmpeg -version (accepts --version, but gives you an error)
gfortran --version

Pascal Oddities

It appears that UpCase() and LowerCase() are built in.
There is also a UpperCase() but it’s requires the sysutils library.
The example for LowerCase() includes a “uses sysutils” but it works without it.
So there is an UpCase() AND UpperCase(), but only a LowerCase()…No LowCase()

In looking at an old Pascal program, I wrote a Right() function that returns the rightmost characters in a string. But there is already a RightStr() function…also in sysutils.

YouTube made some appearance changes

Smaller home page previews…the style looks like odysee.com. Wait… isn’t the little guy supposed to copy the big guy?

Speaking of odysee, I find I constantly have to sign back in. Even worse, there’s no password like every other site, so I can’t simply use my password manager. No… I have to open a email, and click on a link..

Very Annoying!