Some syntax heritance from Blitz2 could be comfortable

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Some syntax heritance from Blitz2 could be comfortable

Post by Psychophanta »

BB2 had some comfortable things about Structures:
If for example we have a structure like this:

Code: Select all

Structure .masa ;<- masa is a new defined type, so then dot prefix.
 x.f:y
 xa:ya  ;<- all these fields are .f until is defined a new one
 r         ;<- float    
 px:py  ;<- float
 masa.l  ;<- long
 mx:my  ;<-long too
 fx.f:fy
EndStructure
After that structure definition:

Code: Select all

NewList p.masa()
and then we must to write p()\ as prefix whenever we need to access to some if the element fields; BB2 has a command called PATH p() to allow to write only \ as prefix for the fields access;
for example: Path p():\r=4:\fx-\masa ...

In BB2 you can do:

Code: Select all

PATH p()
\xa=\x,\y ;<- comma allows assignation to consecutive fields
I forgot...
Most calculators and BB2 allow t.f=.345; why PB demands a 0 before the dot?
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

The command was UsePath, but the command UseLastPath also now exists to go back to the previous path without having to explicitly code it. Useful when used inside "library" procedures.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Yes it is UsePath.
And of course, UseLastPath should be useful too.

I guess Fred is now very busy with Linux version, and he has no time to listen us. :(

I hope single-buffer and triple-buffer for Sprite-Screen library to be implemented soon too. :)
Post Reply