Global bug?
Archives Forums/BlitzMax Bug Reports/Global bug?
| ||
Global a%=1 Type test Global b%=a+10 EndType |
| ||
Using Superstrict it gives an Unknown identifier a, whereas it is no problem to use a in methods oder functions, so I would say it is a problem with the assignment of the value to the global type variable (field works, too). |
| ||
Try this code you'll see that the Code inside Type/EndType gets executed before Main block's execution.superstrict framework brl.standardio global a% = sayHello("Main") Type test global b% = sayHello("Test") EndType function sayHello(name$) print("Hello: " + name) End Function That's why a% is not visibile in Type/EndType. |
| ||
Yeah I can see why it happens, Just wondered if it could be worked around in the compiler, or if it was even intentional in the first place. |
| ||
No idea about the compiler side, should ask Marks. This code is working, but it's not that clean... :) framework brl.blitz strict Global a% = 1 private function getA%() return a End Function public Type test Global b% = 10 + getA() EndType debuglog test.b |