Featured

Blog?

About

This computer, which predated Apple & the TRS-80, was instrumental to the beginning of “personal computers” and resulted in the creation of Microsoft. This in turn resulted in Linus Torvalds wanting something better so he created Linux.

Pascal debugging

There is supposed to be a VS Code debugger extension for Free Pascal.

ext install CNOC.fpdebug

But codium couldn’t find it.

So it appears the best way to debug even Simple Applications is using Lazarus. This creates a project file and everything. You can add breakpoints and look at variables, but writeln() doesn’t output anything. You can still open and run the .lpr with VS Code. It doesn’t appear that you can just open a .lpr or .pas or pp and debug in Lazarus. So I can’t debug my big folder of Pascal programs, I created and tested using Free Pascal, before I knew of Lazarus.

Except for the debugging, Lazarus seems like overkill for simple programs.

Even more proof that I’m right about Pascal typed constants

At this point… I’m beating a dead horse. My previous post about this. I found another book “Object Pascal Handbook” by Marco Cantù. He includes a note in his constants section (He describes it as odd)…

Oddly enough, Object Pascal does allow you to change the value of a typed constant at run-time,
as if it was a variable but only if you enable the $J compiler directive, or use the corresponding
Assignable typed constants compiler option. This optional behavior is included for backward
compatibility
of code which was written with an old compiler. This is clearly not a suggested coding style, and I’ve covered it in this note most as a historical anecdote about such programming
techniques.

However he is slightly wrong also, because he says “only if you enable the $J compiler directive”. Which is not true, because the default behavior (not optional) is to allow this odd behavior. You have to disable this behavior by including the “{$J-}” compiler directive.

Go embeded struc’s

In my previous post, concerning embeded struc’s, I said “I don’t undestand the syntax”. To expand on my misunderstanding, it’s in the creation of p1, specifically the person: person part (see below)

type person struct {
	First string
	Last  string
	Age   int
}

type doubleZero struct {
	person
	LicenseToKill bool
}
func main() {
	p1 := doubleZero{
		person: person{
			First: "James",
			Last:  "Bond",
			Age:   20,
		},
		LicenseToKill: true,
	}
}

I get the second person… it’s the type. But I don’t get the first person. I can’t code person1: person, so if they have to be the same… why require it? Just default to that behavior.

I also said I could just seek further clarification on google or YouTube. So that’s what I did, and ironically I found this explanation from the same instructor. The example he uses is almost identical to the one from the course. And the funny thing is, he had the same problem creating sa1 (I think it’s called type), as I did with the pa1 type above. And specifically the person: person, part. He had to look at his notes to get the syntax correct. To his credit he said he hadn’t done it in a bit.

Also, not really important, but I see he uses OBS. I edit that out.

Go, I won’t let one thing hang me up!

In the Go course, the instructor is talking about embedded struc’s.

And I don’t really understand an example. I understand the purpose/concept, but I don’t undestand the syntax. I can run his code and see that it works. So I’ll just tuck it away in the recesses of my mind, until I have a thought “in this situation…this may be useful”.

Obviously I don’t need it. I’ve written useful Go programs without it. I’m sure they’re, provided for a reason!

Another possibility…just go to google or YouTube for a different explanation.

Minor point. Todd often uses James Bond characters in his examples, and for some reason, refers to Miss Moneypenny, as Jenny 🙂 Wikipedia says, she was “later assigned the first names of Eve or Jane“.

Return to the Udemy Go course

It’s been a while but trying to jump back into Todd’s Go course. Very knowledgeable but trying to match the course content with the course is a challenge. He has some very interesting and useful VS Code tips.

Taking a break from the Udemy Lazarus course but likely won’t return, because of his attitude about change, he doesn’t seem interested in keeping up with advancements. I mean I might not have even questioned his teaching on pre-initializing arrays in the const section, if it didn’t sound so ridiculous and easy to disprove from the start. Silly me for expecting a const, not to be able to change. I mean I’m sure he’s very knowledgable too. But like I said I took the course for the OOP exposure, but at this point I think I’ll do better with the PDF book I have “Modern Object Pascal Introduction for Programmers” by Michalis Kamburelis.