🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by hokey Sun, 26 Apr 1987 20:42
Possible solution to $T stacking on DOs
#8
Author: hokey
Date: Sun, 26 Apr 1987 20:42
53 lines
1826 bytes
I have a possible solution to the problem of stacking $T.

Specifically, upon entering a DO/XECUTE level, $T is stacked iff it has
a defined value.  As DO/XECUTE levels are popped, $T is restored only if
it was saved.

Additionally, permit "KILL $T" (as a means to "undefine" $T).

While this is a slight incompatibility with old code, there is a trivial
way to change the exceedingly rare cases in which software depended on
$T being set in a subroutine.  It is equally trivial to handle the case
in which the subroutine needs to know the "current" value of $T at its
entry, and modify $T at exit.  Examples follow:

	Only want $T at exit:

		;Old code:
		do subr set flag2=$t

		;New code:
		kill $t do subr set flag2=$t

	Subr needs $T at entry, returns "different" $T at exit:

		;Old code
		;$T contains "good stuff"
		do subr
		set flag2=$t
		...
	subr	;
		...

		;New code
		;$T contains "good stuff"
		goto cs1:$t
		k $t d subr0 goto csret
	cs1	k $t d subr1
	csret	set flag2=$t
		...
	subr0	if 0
		goto subr
	subr1	if 1
	subr	;
		...

I have no intention of turning this into a proposal.  If somebody else likes
this approach enough to do so, that's fine with me.

Note that this proposal can obviate the need for special language with
"block structure" which handles $T stacking.

Hokey
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads