You can assign GLOBAL a = foo(), but you are not able to use strings or any of the GLBasic commands inside. The problem is, that this foo() is called in the constructor _before_ the GLBasic engine is set up, whereas
GLOBAL g
g=foo() // this assignement is done during runtime.