Change Define and Protected to Local

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Change Define and Protected to Local

Post by ts-soft »

My wish :)
Define in a Procedure is useless. Local for Procedures and Main-Scope is
more clearly. For DefaulType an extra Keyword, or remove it.

Or set Define = Protected
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Re: Change Define and Protected to Local

Post by remi_meier »

ts-soft wrote:Or set Define = Protected
This would get my vote!
For DefaulType an extra Keyword, or remove it
This one too.
Athlon64 3700+, 1024MB Ram, Radeon X1600
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

All local variables should be protected, this is important in view of Includes file other authors.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

> All local variables should be protected, this is important in view of Includes file other authors.

That would make "Global" pretty useless, would it not ?
quidquid Latine dictum sit altum videtur
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

freak wrote: That would make "Global" pretty useless, would it not ?
No, global is global, all other is local (protected)

In the moment this is useless:

Code: Select all

Global A.l

Procedure foo()
  Define A.l
EndProcedure
A in foo() should protected!

So using global:

Code: Select all

Global A.l

Procedure foo()
  A = 10
EndProcedure
// Edit:
Better example: in the moment

Code: Select all

XIncludeFile "MyGlobals.pbi"

Global a

Procedure foo()
  Define a    ; global
  Define b    ; ???
  Protected c ; lokal 
EndProcedure
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply