Page 2 of 2
Re: Add "Static$ variable" or remove "$" for all keywords
Posted: Mon Mar 04, 2019 3:45 pm
by Marc56us
After using for years .s, I now prefer to use $ for text variables.
So, if I pick up a code later, there is no need to go back to the variable declaration to know if it is a numeric or text variable and fewer possible errors.
The creators of the basic had good ideas from the beginning.

Re: Add "Static$ variable" or remove "$" for all keywords
Posted: Mon Mar 04, 2019 5:57 pm
by Little John
Marc56us wrote:After using for years .s, I now prefer to use $ for text variables.
So, if I pick up a code later, there is no need to go back to the variable declaration to know if it is a numeric or text variable and fewer possible errors.
That's why I also prefer $ for string variables.
However, this thread is about
.s and
$ as suffixes for some
keywords, not for variables. I had mixed that up, too.
@Sicro:
Thank you for editing the title and the first post!
Re: Add "Static$ variable" or remove "$" for all keywords
Posted: Mon Jun 17, 2019 6:43 pm
by olafmagne
Hello,
I totally agree,that the $-sign is useless for declaration-keywords,
but,on the other hand, as a trailing-sign for functions/procedures,also for userwritten , it make sence.
every now and then,i find myself writing it and then wondering,what syntax-error i have made.
IMHO,get rid of it on declarations and add it to the functions as whe know from times gone by (C64 on my mind)
Olaf
Re: Add "Static$ variable" or remove "$" for all keywords
Posted: Mon Jun 17, 2019 9:57 pm
by skywalk
This is what makes PureBasic so helpful when browsing code.
I know immediately I am staring at a string variable x$ or a pointer *ptr.
C drops the pointer(*) after defining and that is a big reason for so many memory bugs.
PureBasic syntax also allows you to retain the .type tail, but I find that too much noise.
For i.i = 0 to nPts.i
x.d + i.i
Next i.i
Re: Add "Static$ variable" or remove "$" for all keywords
Posted: Tue Jun 18, 2019 5:57 am
by Kurzer
Marc56us wrote:After using for years .s, I now prefer to use $ for text variables.
So, if I pick up a code later, there is no need to go back to the variable declaration to know if it is a numeric or text variable and fewer possible errors.
The creators of the basic had good ideas from the beginning.

i dropped using the $ in variables, because i am using a mix of hungary notation and camelcase notation for my variables to determine the variable type on the first sight.
eg.
iNumOfCars ; integer
sNameOfDriver ; string
fSpeedOfCar ; float
dAmountOfGas ; double
stCars ; structured type
and so on...
Sent via mobile phone
Re: Add "Static$ variable" or remove "$" for all keywords
Posted: Tue Jun 18, 2019 12:50 pm
by olafmagne
skywalk wrote:This is what makes PureBasic so helpful when browsing code.
I know immediately I am staring at a string variable x$ or a pointer *ptr.
C drops the pointer(*) after defining and that is a big reason for so many memory bugs.
PureBasic syntax also allows you to retain the .type tail, but I find that too much noise.
For i.i = 0 to nPts.i
x.d + i.i
Next i.i
I totally agree
Olaf
Re: Add
Posted: Wed Jun 19, 2019 12:10 am
by Tenaja
kurzer wrote:
eg.
iNumOfCars ; integer
sNameOfDriver ; string
fSpeedOfCar ; float
dAmountOfGas ; double
stCars ; structured type
and so on...
Sent via mobile phone
That's what I do... Been doing it since I read that how to program windows book in the early x0's...
Re: Add "Static$ variable" or remove "$" for all keywords
Posted: Wed Jun 19, 2019 5:47 pm
by Sicro
kurzer wrote:eg.
iNumOfCars ; integer
sNameOfDriver ; string
fSpeedOfCar ; float
dAmountOfGas ; double
stCars ; structured type
and so on...
Appending the variable type as prefix to the variable name has the disadvantage that the variable type must first be written for the auto-completion function. Usually, however, you only remember the approximate variable name and not also the variable type of the variable.
As long as PureBasic does not use a fuzzy search for auto-completion, the variable type is better appended to the variable name as a suffix in my opinion.