Variable scoping - Local variables inside loops and ifs, etc

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Post by Demivec »

Dummy wrote:Demivec wrote:
A command to "alias" the variable would also be a solution to this scenario.

There's already a solution for your "alias":
Your comments and suggestions about aliasing are valid and helpful, but would seem like they would be better placed in the thread devoted to that topic. I mentioned aliasing in passing only with regard to "limiting variable scoping," the subject of this thread. I mean no disrespect in making this observation. It would seem that you agree that you would define the scope of a variable through a form of aliasing also? Any thoughts regarding ts-soft's idea regarding a range of use encompassing several procedures?
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post by Dummy »

Demivec wrote:
Dummy wrote:Demivec wrote:
A command to "alias" the variable would also be a solution to this scenario.

There's already a solution for your "alias":
Your comments and suggestions about aliasing are valid and helpful, but would seem like they would be better placed in the thread devoted to that topic. I mentioned aliasing in passing only with regard to "limiting variable scoping," the subject of this thread. I mean no disrespect in making this observation. It would seem that you agree that you would define the scope of a variable through a form of aliasing also? Any thoughts regarding ts-soft's idea regarding a range of use encompassing several procedures?
To realize scoping without de-/allocating Memory all the time and through that killing the performance the compiler has to do a sort of aliasing with all scoped vars.
And I think instead of killing Fred with new bugs that might occur through that we could ask for a simple Alias command.

The Alias command as shown in my third codesample could have scopes but still leaves the memorymanagement (the force :P) on side of the one that writes the code.
Post Reply