Re: Goto?
- Posted by Matt Lewis <matthewwalkerlewis at gma?l.c?m> May 13, 2008
- 716 views
Jeremy Cowgar wrote: > > Matt Lewis wrote: > > > > Execution doesn't really care about that stuff. That's all front-end stuff. > > Again, take a look at what exit actually does. It's just a goto, with the > > target implicitly defined as just outside the current loop. > > > > Hm, but couldn't it invite bugs in the compiler? For instance, look at > compile.e > around line 146. It checks the length of the loop_stack and makes a decision > based on it. Line 3792 dereferences variables (which I assume opens it up for > either freeing or re-use of that memory) in the end loop. Now, I do see on > line > 3873 where return will deref any open loop vars but that will not handle > top-level > stuff. > > Just trying to learn the code. Not sure if this would be a problem or not. I haven't gotten into the translator as much as the interpreter. But in general, goto worked in the translator for me. That part you pointed to looks like something Rob put in there to decide when to break up files to keep certain compilers from choking. I don't think it has an effect on the code otherwise. I think it would only affect top level code with gotos. An easy solution is to disallow them at the top level. Matt