[Gambas-user] PRB-info: Expression evaluation

Ron Onstenk ronstk at ...239...
Sun Nov 14 10:13:05 CET 2004


changed line in project from:
    cbxShell.Y=ME.H - cbxShell.Height
to
    cbxShell.Y=ME.clientH - (cbxShell.Height +10)

I get a 'missing right brace' error. First it is here a parenthesis ')'.
I know this from the interpreter I once wrote for basic
long, long time back (1976 2kbyte z80 code) 

Very strict the line is indeed wrong, but it is another mistake. 
The error here is more as 'Bad expression' I think.

The intention is to add the values of cbxShell.Height and 10 together, 
here is written now 'cbxShell.Height' and '+10' but no addition action. 
It should be 'cbxShell.Height + +10', looks awfull but is right. :)

The + is the sign for 10, it could be 'cbxShell.Height + -10' effective 
as add a negative value or substract 10 written as 'cbxShell.Height - +10'.
The positive sign is not always shown but in background exist.

'cbxShell.Height+10' works OK and the 'missing right ???' is gone.
'cbxShell.Height+-10' works OK
'cbxShell.Height++10' does not work but strict it is right and should work.
'cbxShell.Height+ +10' is more correct to read and works OK

((+|-)variable) (+|-) ((+|-)variable)
The middle (+|-) is the method, the other are sign prefix of the variable.
The middle can also be (*|/) according the arithmetic priority.
The spaces around the method are more clear to read but optional no need 
for as clear seen with * and / but with + - it easy to misunderstand.

I made the mistake myself now but it can be nice to know for other
to write the calculation right and for the case they get the 
'Missing Right ???' where the fault can be.



Ron




More information about the User mailing list