Pier (and Seaside) use dynamic variables to retrieve the value of the session or current context whose value is defined at runtime by the calling context. They enhance testability as mock or known dynamic variable can be defined within the context of a test.

How do dynamic variables work. Examining the code:

PRCurrentContext class
	"This is the read accessor of the current context."

	| holder |
	holder := self signal.
	^ holder isNil ifFalse: [ holder context ]
PRCurrentContext class
value: aContext
	"This is the write accessor of the current context."

	self signal context: aContext

notice how these methods call context/context: on the results from: self signal which in turn is the ‘anObject` passed in:

PRCurrentContext class
use: anObject during: aBlock
	^ aBlock on: self do: [ :notification | notification resume: anObject ]

PRContextFilter passes presenter to use:during:

handleFiltered: aRequestContext
	^ PRCurrentContext use: presenter during: [ super handleFiltered: aRequestContext ]

PRContextFilter is created in:

initialRequest: aRequest
	| structure following |
	super initialRequest: aRequest.
	self session
		addFilter: (PRContextFilter on: self).
	following := self context
		structure: (structure := self
			parseStructure: aRequest
			ifAbsent: [ ^ self notFound ])
		command: (self
			parseCommand: aRequest
			structure: structure).
	following command
		initialRequest: aRequest.
	self context: following