PB Trivia - Parentheses are not allowed in string operations

Everything else that doesn't fall into one of the other PB categories.
buddymatkona
Enthusiast
Enthusiast
Posts: 252
Joined: Mon Aug 16, 2010 4:29 am

PB Trivia - Parentheses are not allowed in string operations

Post 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."
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

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

Post 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. :)
I may look like a mule, but I'm not a complete ass.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

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

Post 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
Post Reply