Page 1 of 1

PB Trivia - Parentheses are not allowed in string operations

Posted: Sun Aug 19, 2012 5:56 pm
by buddymatkona
The PB parenthesis limitation may be defined as a feature however I expected balanced outer parentheses to just be discarded.

Code: Select all

S1$ = " String1 "
S2$ = " String2 "
S3$ = (S2$)                 ; This works with unnecessary outer parentheses.
Debug S1$ + "Plus" + S2$   ; This works.
Debug S1$ + "Plus" + (S2$) ; This fails: "Parenthesis '(' are not allowed in string operations."

Re: PB Trivia - Parentheses are not allowed in string operat

Posted: Sun Aug 19, 2012 7:00 pm
by srod
Having just finished my own compiler I can say that I have also forbidden parentheses in such expressions; it made expression folding easier when dealing with constant string expressions.

Whether this is the same reason for PB I cannot say. :)

Re: PB Trivia - Parentheses are not allowed in string operat

Posted: Sun Aug 19, 2012 8:33 pm
by rsts
They used to be permitted. Somewhere in the mid-4 series they were dis-allowed due to some possible abuse/confusion. There was a topic that led to it.

Personally, I preferred when they were permitted. Sometimes compiling old code will lead to the message.

cheers