User Tools

Site Tools


bless

Table of Contents

Synopsis:

Technical:

Ordinarily, the local variables of an atomic scope are only visible to that atomic scope, and cannot be used outside. Sometimes you need to be able to access an atomic scope's local variables within another atomic scope. Two atomic scopes can cooperate at runtime to accomplish this if the enclosing scope does wait and the enclosed scope does bless.

Each bless attaches itsself to the oldest unmatched wait. If you have waits pending, and then do a wait+bless combo, the results may be disasterous, or hilarious, depending on your mood.

Presently bless ignores its arguments, but this will not always be the case, so you should not supply any arguments for forwards compatability.

Example:

This is best demonstrated with an example:

alias uh 
{
	^local blahblah
	wait for {
		^userhost $* -cmd {
			bless
			push blahblah $3@$4
		}
	}
	return $blahblah
}

To share variables between aliases, use the “CrazyEddy technique”:

alias one {
	bless
	@ :hi = 'this is a test'
}
alias two {
	@ :hi = 'this is the first value'
	one
	echo $hi
	wait for { one }
	echo $hi
}

This outputs 'this is the first value' and 'this is a test'. In the first case, the bless has no effect because nobody is waiting for it. In the second case, alias one can change the local variable in alias two because alias two is waiting for it.

History

The bless command first appeared in EPIC4pre0.009.

#$EPIC: bless.txt,v 1.3 2006/07/17 20:11:14 sthalik Exp $

bless.txt · Last modified: 2006/07/25 21:22 (external edit)