[Logiweb] pyk warning: * imply * mistakenly unfit?
Klaus Ebbe Grue
grue at diku.dk
Wed Jun 1 12:12:05 CEST 2005
Hi Kasper,
> "[ math value define
> var x imply var y
> as
> var x macro imply var y
> end define end math ]"
> ...
> * imply * mistakenly unfit?
> ...
> Does anyone know what the warning means?
It means that the definition is "unfit for optimization". In other words,
it will be slow compared to a "fit" definition.
You can to three things:
(1) Ignore the message.
(2) Ignore the message + get rid of the message.
(3) Make the definition "fit".
Concerning (3). After macro expansion, "x imply y" has the property that
if x is false then "x imply y" returns T without evaluating y. For that
reason, "x imply y" is "non-strict" in y. Logiweb has a particularly
efficient way of translating strict constructs. To make the definition
above strict in y, replace "var x macro imply var y" by
var y guard parenthesis var x macro imply var y end parenthesis
The "u guard v" constructs computes u, discards the value, computes v, and
returns the value of v. It is convenient for making definitions strict.
Concerning (2). Very many constructs are "unfit". To avoid too many error
messages, the compiler tries to guess whether or not a construct was
intended to be "fit". To indicate its uncertainty, the compiler says
"construct xyzzy mistakenly unfit?".
At present, a function is "fit" if all constructs on the right hand side
of the defintion are either "fit" themselves or parameters that occur on
the left hand side. Furthermore, the construct being defined must be
strict.
When the compiler deems a construct unfit, it looks at the root of the
right hand side. If the root of the right hand side is unfit, the compiler
thinks the construct is unfit on purpose and generates no error message.
So the second approach is to put an unfit identity operator in the root,
ie. to change "var x macro imply var y" to
identity var x macro imply var y end identity
The "identity u end identity" construct is an unfit operation that just
returns u (to see that it is unfit, you have to read the *full* story
about fitness analysis in Sectin 3.6 of the base page).
If a page contains more than one unfit operation, the compiler just
reports the number and refers you to look in a Lisp variable for the names
of the unfit operations. That is unfortunate since, when the compiler is
invoked from the Linux shell, the compiler quits Lisp before you have a
chance to inspect that Lisp variable. I work on a solution.
-Klaus
More information about the Logiweb
mailing list