F07) Why doesn't the compiler complain about a missing inner in a body fragment?
Description
This article is from the FAQ, by with numerous contributions by
others.
F07) Why doesn't the compiler complain about a missing inner in a body fragment?
The BETA compiler permits the following fragments:
top.bet:
ORIGIN '~beta/basiclib/v1.6/betaenv';
BODY 'testBody'
--- lib: attributes ---
test: (# do <<SLOT testBody: descriptor>> #)
--- program: descriptor ---
(# do test(# do ... #) #)
testBody.bet:
ORIGIN 'top'
--- testBody: descriptor ---
(# do (* no inner! *) #)
Why does the compiler allow the specialization of test in the program slot
even though there is no inner in the definition of test (as can be seen in
the testBody fragment)?
The reason is that the testBody fragment may be compiled separately, and
later changed without recompiling or rechecking the top.bet fragment. That
is, even though the testBody might originally have included an inner, there
is no way to ensure that later changes do not remove it (without sacrificing
the separate compilation ability).
Note: This behavior is consistent with the compiler not performing flow
analysis to ensure that all execution paths of a pattern contain an inner.
For example,
foo: (# do (if true then (* nothing! *) else inner if) #)
bar: foo(# do ... #);
is legal even though bar's do-part is never executed.
 
Continue to: