Crash Accessing Field from Function inside Method
Archives Forums/BlitzMax Bug Reports/Crash Accessing Field from Function inside Method
| ||
Runs in debug mode, crashes without error in release mode after printing "in".SuperStrict Framework BRL.StandardIO Type TTest Field s:String = "hello world" Method Emit() Function Out() Print s End Function Print "in" Out Print "out" End Method End Type Local t:TTest = New TTest t.Emit |
| ||
Its not supposed to work either ;) A function inside another function or method, is still a global function, its just not visible outside. The reason it sometimes work, is because the Self pointer is still on the stack somewhere. Pass Self as a parameter instead, i know not as good looking, but at least it wont hang at random intervals hehe |
| ||
Yeah. It doesn't make sense that "s" would have scope inside a global function. It should probably throw a compiler error. |
| ||
Yeah. It doesn't make sense that "s" would have scope inside a global function. But I could easily see how someone would think of it in that inheritable way. |
| ||
Yeah, it's probably not supposed to work, but oddly it does in debug mode. Something similar works in some languages, especially the more functional-programming-oriented ones. Anyway, this should probably give an error at compile time. |
| ||
Hi, Yes, the compiler should be picking this up - 's' shouldn't be visible to the function. |