C08) What is the difference between P and &P?
Description
This article is from the FAQ, by with numerous contributions by
others.
C08) What is the difference between P and &P?
Consider the following BETA program:
(# P: (# do ... #)
do P; &P
#)
Compiling this program with the current BETA compiler shows no difference in
the code generated for P and &P.
However, the semantics of BETA defines a difference, namely that P is the
execution of an inserted item and that &P is the creation and execution of a
dynamic item, one of the differences being that inserted items are only
allocated once, irrespectively of how many times they are executed.
The current BETA compiler implements inserted items as dynamic ones, thereby
not taking advantage of the potential possibility for optimization. This
limitation will be removed in a future release of the compiler.
 
Continue to: