Add this to PB3.50 Docs

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Amiga5k.

Hi, I'm new here!

Speaking of >> and <<, am I the only one who thinks these are backwards? << (pointing left) should be shift left, not shift right.

Also, I'm still looking over the docs, but what's this 'fakereturn' stuff? Is this only needed with goto commands? If so, no problem, as I haven't used goto since the good 'ol C-64 basic days...

Thanks

***I snatch kisses!***
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Amiga5k.

Ok, I'm an idiot :) Forgot to read all of the messages before posting... ('>' are incorrect in the manual). The 'FakeReturn' part still stands, though...

Thanks!
Russell

***I snatch kisses!***
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> what's this 'fakereturn' stuff?

It's for when you Gosub to a routine, but want to jump out of it with
Goto, without reaching the Return. Doing this is normally a no-no,
because the stack never gets cleared because Return isn't called.
But using FakeReturn before Goto clears the stack, keeping your app
stable. In other BASICS it's usually called "Pop", ie. Pop Gosub,
followed by the GoTo command.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.
Originally posted by PB

> what's this 'fakereturn' stuff?

It's for when you Gosub to a routine, but want to jump out of it with
Goto, without reaching the Return. Doing this is normally a no-no,
because the stack never gets cleared because Return isn't called.
But using FakeReturn before Goto clears the stack, keeping your app
stable. In other BASICS it's usually called "Pop", ie. Pop Gosub,
followed by the GoTo command.
Hi PB,
The olds Basics (True-Basic, the authors and others) work all time with RETURN (If this is only RETURN, clear the stack) and if you want go to another position in the program the *RETURN Flag* clear the stack if the condiction is OK, if not, continue with the program to the next RETURN. "Pop Gosub"??? first time fo me.
Example:
FIRST:
Input A
GOSUB MYSUB
the next instruction

MYSUB:
If A=10
RETURN (Clear the stack)
Else
RETURN FIRST (Clear the stack)

Goto??? Sorry. Old system and 1 command more
FakeReturn??? Only for clear the stack.

Manolo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tinman.
Originally posted by Manolo

Goto??? Sorry. Old system and 1 command more
FakeReturn??? Only for clear the stack.
Goto an old system and you are wanting to use Gosub...Return? Ironic... :wink:

Just to point out a different point of view, I do not think I have ever seen the return command used with a label name :)

I agree that it might be better to have a single command for doing this. At the moment the possibility exists for the user to make a mistake by forgetting one of the commands. However, as separate commands, they can be useful for some tricks, such as

Code: Select all

FakeReturn
Return
If you want to jump back 2 Gosubs in one position.

--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.40)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> "Pop Gosub"??? first time fo me.

It exists; mainly in the very old languages, but it's even in Blitz.
There's even things like "Pop For" and so on, too. :)

http://groups.google.com.au/groups?selm ... b08%40huey
Post Reply