Dancing with labels...

Just starting out? Need help? Post your questions and find answers here.
User avatar
Melissa
User
User
Posts: 71
Joined: Tue Sep 22, 2009 3:13 pm

Dancing with labels...

Post by Melissa »

Just got bored once again:

Code: Select all

*Label : Goto *Label
; Syntax error
...However...

Code: Select all

*Label : *Label :
; Error: duplicate label.
Not too disturbing, indeed, but still need more love.
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

Re: Dancing with labels...

Post by UserOfPure »

You can report a bug for anything if you mess up the names with invalid characters. What do I mean? Well, the manual (which you read?) says that labels can't contain operators, yet you used * in the label name. Remove the * like the manual says and both examples are fine, in that the first loops endlessly and the second reports a duplicate label.

In other words, what you've done is the equivalent of reporting this as a bug, because it too gives a syntax error:

Code: Select all

*CreateImage(1,640,480) ; Syntax error.
User avatar
Melissa
User
User
Posts: 71
Joined: Tue Sep 22, 2009 3:13 pm

Re: Dancing with labels...

Post by Melissa »

Well, you are right - it's seems to be just a limitation of parser. So, there are some solution:

Code: Select all

*Label : Goto Label
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: Dancing with labels...

Post by Kuron »

Melissa wrote:Not too disturbing, indeed, but still need more love.
:D
Best wishes to the PB community. Thank you for the memories. ♥️
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Re: Dancing with labels...

Post by fsw »

Melissa wrote:Well, you are right - it's seems to be just a limitation of parser. So, there are some solution:

Code: Select all

*Label : Goto Label
The Help file states:
Labels

All labels must be followed by a : (colon). Label names may not contain any operators (+,-,...) as well special characters (ß,ä,ö,ü,...).
You don't have to put the operator * in front of the label name, and it's not a pointer either...

Besides it's good practice to do:

Code: Select all

LabelName:
(no space between the label name and the colon) instead of:

Code: Select all

LabelName :
because colon can be used to concatenate commands like:
If IsCrazy = 0 : MessageRequester("Info", "Not Crazy") : Else : MessageRequester("Info", "Crazy") : EndIf
Hope to have cleared some things up.

Take care
fsw

BTW: the last example is straight from the help file. The words used in the example don't imply a connection to a person reading it...
...I hope. If somebody needs further clarification on this please contact the original writer of the help file. Thanks.
User avatar
Melissa
User
User
Posts: 71
Joined: Tue Sep 22, 2009 3:13 pm

Re: Dancing with labels...

Post by Melissa »

OK, some more tests:

Code: Select all

+Label : ; Syntax Error

Code: Select all

-Label : ; Syntax Error

Code: Select all

/Label : ; Syntax Error
...Looks like that parser just unable to distinguish label from pointer on definition stage. Well, since I already found such usage in some polyglot code – may be a feature as well.
Besides it's good practice to do:
Just testing, really.
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Re: Dancing with labels...

Post by Rings »

moved....
SPAMINATOR NR.1
User avatar
Melissa
User
User
Posts: 71
Joined: Tue Sep 22, 2009 3:13 pm

Re: Dancing with labels...

Post by Melissa »

Well, since Ring officially stated here that ability to define *–powered labels is actually a feature, may be some correction in documentation (“Label names may not contain any operators”) should be made ^^ ?
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

Re: Dancing with labels...

Post by UserOfPure »

Rings isn't a team member. He's just a forum mod. (No offense intended, Rings). The docs are correct until the team says otherwise.
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Re: Dancing with labels...

Post by Rings »

The docs are clear for me,
such syntax is not allowed in PB (neither in classic VB )
so its not a bug,
That is why i moved that topic.
And this is not a statement.
SPAMINATOR NR.1
User avatar
Melissa
User
User
Posts: 71
Joined: Tue Sep 22, 2009 3:13 pm

Re: Dancing with labels...

Post by Melissa »

UserOfPure wrote: Rings isn't a team member. He's just a forum mod.
It was kind of sarcasm). Well, now we just should decide what is wrong here:

Code: Select all

*Label :  Goto Label ; No errors generated !
...or...
Official manual wrote:Label names may not contain any operators
...’cause there are obvious conflict here. May be some poll would help ^^ ?
Rings wrote:such syntax is not allowed in PB (neither in classic VB )
It is allowed (partially). Just look above.
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

Re: Dancing with labels...

Post by UserOfPure »

If it works, it's just a fluke. Just obey what the docs say and be done with it. Don't use the *. Easy.
User avatar
Melissa
User
User
Posts: 71
Joined: Tue Sep 22, 2009 3:13 pm

Re: Dancing with labels...

Post by Melissa »

If it works, it's just a fluke.
Then, if it isn't intended behavior, thread should be moved back to "Bug Reports", right ?
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

Re: Dancing with labels...

Post by UserOfPure »

No, because it's not a bug if you don't do what the manual says. And I feel like I'm feeding the troll here.
User avatar
Melissa
User
User
Posts: 71
Joined: Tue Sep 22, 2009 3:13 pm

Re: Dancing with labels...

Post by Melissa »

No, because it's not a bug if you don't do what the manual says
So, isn't a bug when compiler doesn't do required checks for enforcing syntax rules ? I'm out of words here.
And I feel like I'm feeding the troll here.
Honestly ? Me too.
Post Reply