Re: [Gambas-user] Possible suggestion/question

2012-03-02 Thread Benoît Minisini
Le 02/03/2012 20:03, Jussi Lahtinen a écrit : > I made quick effort to try to simulate gosub with goto, > and noticed that jumping back inside loops is not possible (as the > documentation says...). > > I understand that when it's For ... Next, but shouldn't that be possible > with Do ... Loop Unti

Re: [Gambas-user] Possible suggestion/question

2012-03-02 Thread Emil Lenngren
You can always hack the compiler/bytecode to be able to have gotos wherever you want, but I think Gotos is not allowed to jump into control structures because it is classed as "bad code structure". For ... Next also use hidden local variables to store things. But I think gosubs can be implemented

Re: [Gambas-user] Possible suggestion/question

2012-03-02 Thread Jussi Lahtinen
I made quick effort to try to simulate gosub with goto, and noticed that jumping back inside loops is not possible (as the documentation says...). I understand that when it's For ... Next, but shouldn't that be possible with Do ... Loop Until x? Anyway, I'm not sure my simulation does accurately

Re: [Gambas-user] Possible suggestion/question

2012-03-02 Thread Emil Lenngren
GOTO is not evil, but can, if you do it "wrong", result in code that might be hard to read. For example, in C you can do like this: if (a){ goto a_label; } else { if (b){ switch(c){ case 1: puts("Hello"); break; case 2: puts("Yo"); break; a_label: puts("Tjena"); brea

Re: [Gambas-user] Possible suggestion/question

2012-03-02 Thread M. Cs.
I red somewhere that GOTO is something that a good programer should avoid at all costs. GOTO is a host of countless bug possibilities. 2012/3/2, John Spikowski : > On Fri, 2012-03-02 at 03:31 +0100, Benoît Minisini wrote: >> Anyway, there is a syntax problem. In Basic, GOSUB is ended by a RETURN >

Re: [Gambas-user] Possible suggestion/question

2012-03-01 Thread John Spikowski
On Fri, 2012-03-02 at 03:31 +0100, Benoît Minisini wrote: > Anyway, there is a syntax problem. In Basic, GOSUB is ended by a RETURN > instruction, but RETURN is already used to exit the all function. Or > maybe RETURN will return from the function only if there is no pending > GOSUB. > Most Bas

Re: [Gambas-user] Possible suggestion/question

2012-03-01 Thread Benoît Minisini
Le 25/02/2012 19:18, nando a écrit : > Benoit, > > I came across the need to call many different common small pieces of code > multiple times. > Naturally, we tend to make a SUB just for all of them. > > I wondered if you'd consider resurrecting GOSUB {label} > which is in the same sub. > > It wou

[Gambas-user] Possible suggestion/question

2012-02-25 Thread nando
Benoit, I came across the need to call many different common small pieces of code multiple times. Naturally, we tend to make a SUB just for all of them. I wondered if you'd consider resurrecting GOSUB {label} which is in the same sub. It would be in the same scope, no parameters allowed and act