New to PB - learning from Kale's book

Just starting out? Need help? Post your questions and find answers here.
Median Joe
New User
New User
Posts: 6
Joined: Thu Aug 19, 2021 10:38 am

New to PB - learning from Kale's book

Post by Median Joe »

Hi guys,

I'm just starting out with PB and am learning from Kales's book, which is very good and easy to understand. The book is pretty old and there have been many additions to the libraries and language since it was written but I'm assuming they will all be backwards compatible with version 4.0? Having worked through the book I don't want to have to "unlearn" anything (I'm not interested in using PB for games or 3d, so I will skip those chapters).

I'm not new to programming, having used freepascal/Lazarus for several years, but OOP is not to my taste, and also I use Linux, and don't have a Windows licence, but Lazarus doesn't work well using Wine. Fortunately, PB works flawlessly on it (although not the IDE, but I only need the command line) so I can create my GUI programs on Linux and then compile for Windows using Wine.

Thanks in advance for any advice!
User avatar
jacdelad
Addict
Addict
Posts: 2029
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: New to PB - learning from Kale's book

Post by jacdelad »

PB 5.73/6.00 is mostly compatible with 4.00. Generally it tells you when something is incompatible or deprecated.

But what exactly is your question?
Last edited by jacdelad on Sat Aug 21, 2021 2:45 am, edited 1 time in total.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Median Joe
New User
New User
Posts: 6
Joined: Thu Aug 19, 2021 10:38 am

Re: New to PB - learning from Kale's book

Post by Median Joe »

The book is 15 years old. I just wanted to ask whether everything in it is still valid. You've answered my question, thanks!
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: New to PB - learning from Kale's book

Post by BarryG »

Median Joe wrote: Fri Aug 20, 2021 4:28 pmI just wanted to ask whether everything in it is still valid
No. Small changes will be needed, but as jacdelad said, PureBasic will alert you if you're trying to use an unsupported or changed command.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: New to PB - learning from Kale's book

Post by Tenaja »

The biggest change was when pointer typing was removed. Other changes are in the well-documented History (in Help). The Changes sections will be of interest.
Median Joe
New User
New User
Posts: 6
Joined: Thu Aug 19, 2021 10:38 am

Re: New to PB - learning from Kale's book

Post by Median Joe »

Thanks, I didn't see that section in the help file. It seems there were 77 changes and 37 removals since version 4.0. Of course there were lots of additions too, including Maps, which aren't mentioned in the book. I've just discovered ninelizards.com, which is very helpful for learning and more up to date than the book.
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: New to PB - learning from Kale's book

Post by infratec »

I always use the PB IDE in linux. (PB 5.73)
What is your problem with it?
Median Joe
New User
New User
Posts: 6
Joined: Thu Aug 19, 2021 10:38 am

Re: New to PB - learning from Kale's book

Post by Median Joe »

Not sure why you think I have a problem with the IDE? But as you ask, I'm a long time Vim user which makes it hard to use any other editor. If the IDE (which is very good) had Vim bindings I would definitely use it, but I don't think that's going to happen. :wink:
Bitblazer
Enthusiast
Enthusiast
Posts: 766
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: New to PB - learning from Kale's book

Post by Bitblazer »

Welcome to PureBasic.

The purebasic IDE can be customized. The information how to do it is here. So you could just set the most important shortcuts to the VIM settings you are used to.
Median Joe
New User
New User
Posts: 6
Joined: Thu Aug 19, 2021 10:38 am

Re: New to PB - learning from Kale's book

Post by Median Joe »

Hi BitBlazer, thanks for the tip. The IDE has many great features, but it's not a modal editor like Vim. Sure, I can set up shortcuts which will reduce "mouse mileage", but they won't eliminate it completely. Editing consists mainly of typing and manipulating text, which in Vim can ALL be done without ever having to leave the keyboard. Having learned it, it's very hard to go back to a conventional editor. I see there is a PB extension for Visual Studio Code, which also provides Vim bindings, so I may give that a try in place of vanilla Vim.
User avatar
chikega
User
User
Posts: 40
Joined: Fri Dec 04, 2020 3:19 am

Re: New to PB - learning from Kale's book

Post by chikega »

Hey Median Joe,
I'm in the same boat ... learning PureBasic from Kale's book but supplementing it with Pure Basic Survival Guide and with Guillaume's excellent Pure Programming video series.

Some of the 'gotchas' I learned early on is that PB's default data type is no longer the 'long'(.l) but the 'integer'(.i). Also, ValQ ( StrQ as well) is mentioned in the book but is deprecated - the PB compiler will still run it but gives you a warning in the debugger.

Cheers,

Gary
Gary E Chike DMD MS
'Experience is what you get when you don't get what you want' Image
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: New to PB - learning from Kale's book

Post by BarryG »

chikega wrote: Sat Aug 28, 2021 6:50 amSome of the 'gotchas' I learned early on is that PB's default data type is no longer the 'long'(.l) but the 'integer'(.i)
I've always wondered why this is a "gotcha". I never changed my variables and my apps don't run any different? Is it because I'm using the 32-bit version?
User avatar
mk-soft
Always Here
Always Here
Posts: 6315
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: New to PB - learning from Kale's book

Post by mk-soft »

BarryG wrote: Sat Aug 28, 2021 8:27 am
chikega wrote: Sat Aug 28, 2021 6:50 amSome of the 'gotchas' I learned early on is that PB's default data type is no longer the 'long'(.l) but the 'integer'(.i)
I've always wondered why this is a "gotcha". I never changed my variables and my apps don't run any different? Is it because I'm using the 32-bit version?
Yes, that will be a problem when switching from 32bit to 64bit.
An integer is adapted to the operating system. If you use handles or ID's as long on 64bit system, it can lead to addressing errors.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: New to PB - learning from Kale's book

Post by BarryG »

So even though I compile with 32-bit PureBasic, I should search/replace any ".l" with ".i" and my exe still work on both 32-bit and 64-bit PCs?
User avatar
mk-soft
Always Here
Always Here
Posts: 6315
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: New to PB - learning from Kale's book

Post by mk-soft »

Yes,

But see if a LONG is explicitly required somewhere. For example as a filter or conversion, and special structures ...
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply