Page 2 of 2
Re: EnableExplicit and For loops
Posted: Sat Apr 21, 2012 2:18 pm
by Tenaja
Little John wrote:Just appending a type identifier such as .i to a variable name (without using Define, Global, Protected or Static) is currently not considered expilict declaration of a variable in PB. If your suggestion would be implemented in this way, it would change the meaning of EnableExplicit. That would cause unnecessary confusion.
Regards, Little John
I'm with LJ on this. Imagine being required to type this...
Code: Select all
Procedure Foo()
For counter = 1 To 10
protected.i counter
Next
EndProcedure
And this is just a mess:
Code: Select all
Procedure Foo()
scope
protected.i counter
For counter = 1 To 10
Next
endscope
EndProcedure
I think the challenge is that Fred did not structure the original language with this path in mind. The result is a system that works quite well, but is not well suited to a change in this direction. And yes, there has been a time or two where I would have used this feature, but in reality it does not add "much" to what PB has already. I'd rather he work on cross-compatibility or speed. (Or whatever the most popular request were in the poll...)
Re: EnableExplicit and For loops
Posted: Sat Apr 21, 2012 2:28 pm
by Tenaja
AHA! I have come up an alternative.
The big issue is the EnableExplicit requirement of using one of those keywords. In C, you are only required to use the var "type", such as int i, despite having many other modifiers available. Maybe if Fred added an intermediate EnableExplicitType (a "light" explicit, if you will) that only required the "type", then we could use this with impunity:
Code: Select all
Procedure Foo()
For counter.i = 1 To 10
Next
EndProcedure
I have always thought it weird that you could define a variable in so many ways...
1. just start using it
2. Use it with the appended type
3. Defining it with a keyword
And was never fond of 2 without 3.
And while this alternative is certainly viable, clean, and backward compatible, and even desireable, I still would rather he work on other stuff.
Re: EnableExplicit and For loops
Posted: Sat Apr 21, 2012 2:31 pm
by Little John
Tenaja wrote:Little John wrote:Just appending a type identifier such as .i to a variable name (without using Define, Global, Protected or Static) is currently not considered expilict declaration of a variable in PB. If your suggestion would be implemented in this way, it would change the meaning of EnableExplicit. That would cause unnecessary confusion.
Regards, Little John
I'm with LJ on this.
But what you wrote is more or less the contrary of what I wrote ...

Re: EnableExplicit and For loops
Posted: Sat Apr 21, 2012 2:48 pm
by Tenaja
No, my original post ("I'm with LJ on this...") 100% agrees with what you said. The examples are an ugly mess, and changing the definition of EnableExplicit would be confusing--and worse, it would be problematic for backwards compatibility. Perhaps "Imagine being required to type this..." did not come across the language barrier, but it was a rhetorical statement showing an undesirable example. And if we are not now on the same page, then I still do not know what your point was.
The only thing I suggested that did not agree with you was in my second post, and that would be the possibility of adding a new directive that was EnableExplicitLight, or EnableExplicitType, and that suggestion does not contradict with anything you said--it merely adds an alternative.
Re: EnableExplicit and For loops
Posted: Sat Apr 21, 2012 2:53 pm
by Tenaja
Kukulkan wrote:I understand and can follow the argumentation of foz.
What about this syntax:
Code: Select all
Protected value
For Protected counter.b = 0 To 10
value + counter
Next
The drawback is, that Protected is no longer a valid variable name (now a reserved keyword). Or is it already (I don't know)?
Kukulkan
This would work, and it would be backward compatible. It would also automatically give scope. This does have merits that Fred could consider.
Re: EnableExplicit and For loops
Posted: Sat Apr 21, 2012 3:15 pm
by Little John
@
Tenaja:
I do not want you (or anyone else) to distort the meaning of my posts. My life time is limted, and after posting a message, I don't want to post three additional messages just in order to explain what I did
not write in the other message. Shouldn't be too hard to understand. You are free to write what you want, but just let me alone

Re: EnableExplicit and For loops
Posted: Sun Apr 22, 2012 5:42 pm
by Tenaja
Little John wrote:@
Tenaja:
I do not want you (or anyone else) to distort the meaning of my posts. My life time is limted, and after posting a message, I don't want to post three additional messages just in order to explain what I did
not write in the other message. Shouldn't be too hard to understand. You are free to write what you want, but just let me alone

Ok, well, I apologize if I do not communicate clearly sometimes. The bottom line is that I agreed fully with your post that I quoted.