PureBasic 5.30 is out !

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: PureBasic 5.30 is out !

Post by blueznl »

I spotted one troublesome change in 5.30 (not sure if it should be considered a bug, it's more like something being overlooked)...

> Changed: DataSection label within Procedure are now local labels.

I think this isn't such a good idea. (Well, at least for me it isn't :-)) or perhaps labels / datasections deserve the keyword 'Global'.

Here's the issue:

I have some code with many include files. To keep the (folded) code clean I grouped most of those includes together in a procedure called 'init()'. Put the cursor on the Procedure init() line, hit F4, and voila, all includes are hidden from sight.

Previously I could refer to the includes using their labels, all throughout my code. Now the only way to access those includes is to place them outside a procedure, otherwise the label won't be found.

I think a better solution would be allowing the use of the keyword Global, either with Datasection (and have all labels within the datasection be global) or use the keyword Global in combination with the labe itselfl.

As it is now, I'm a bit stuck with 5.30. I don't want to move all includes to the 'root' of my code so I guess I'll go back to 5.22 LTS...

(I haven't checked out the next beta, did it fix this?)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: PureBasic 5.30 is out !

Post by IdeasVacuum »

How about putting the includes in a separate .pbi file?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Danilo
Addict
Addict
Posts: 3037
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: PureBasic 5.30 is out !

Post by Danilo »

blueznl wrote:To keep the (folded) code clean I grouped most of those includes together in a procedure called 'init()'. Put the cursor on the Procedure init() line, hit F4, and voila, all includes are hidden from sight.
You can create sections for folding easily without putting it into procedures:

Code: Select all

;{ data sections
DataSection
    myLabel: : Data.i 10
EndDataSection
;}
Add your own markers in Preferences > Editor > Folding.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: PureBasic 5.30 is out !

Post by blueznl »

Well, I'll just settled for adding another global var, that fixed it as well:

Code: Select all

...
Datasection
  whatever:
  Includebinary ....
EndDatasection
Global include_whatever = ?whatever
...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply