Page 1 of 1
New to PB - learning from Kale's book
Posted: Fri Aug 20, 2021 11:20 am
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!
Re: New to PB - learning from Kale's book
Posted: Fri Aug 20, 2021 3:08 pm
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?
Re: New to PB - learning from Kale's book
Posted: Fri Aug 20, 2021 4:28 pm
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!
Re: New to PB - learning from Kale's book
Posted: Sat Aug 21, 2021 1:05 am
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.
Re: New to PB - learning from Kale's book
Posted: Sat Aug 21, 2021 3:02 pm
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.
Re: New to PB - learning from Kale's book
Posted: Sat Aug 21, 2021 4:38 pm
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.
Re: New to PB - learning from Kale's book
Posted: Sat Aug 21, 2021 5:46 pm
by infratec
I always use the PB IDE in linux. (PB 5.73)
What is your problem with it?
Re: New to PB - learning from Kale's book
Posted: Sat Aug 21, 2021 7:07 pm
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.

Re: New to PB - learning from Kale's book
Posted: Sat Aug 21, 2021 8:27 pm
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.
Re: New to PB - learning from Kale's book
Posted: Tue Aug 24, 2021 7:02 am
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.
Re: New to PB - learning from Kale's book
Posted: Sat Aug 28, 2021 6:50 am
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
Re: New to PB - learning from Kale's book
Posted: Sat Aug 28, 2021 8:27 am
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?
Re: New to PB - learning from Kale's book
Posted: Sat Aug 28, 2021 10:18 am
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.
Re: New to PB - learning from Kale's book
Posted: Sat Aug 28, 2021 11:08 am
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?
Re: New to PB - learning from Kale's book
Posted: Sat Aug 28, 2021 1:00 pm
by mk-soft
Yes,
But see if a LONG is explicitly required somewhere. For example as a filter or conversion, and special structures ...