Idea about deferred slots

Damien Bouvarel dams.bouvarel at wanadoo.fr
Thu Sep 10 10:59:29 UTC 2009


Hello,

I think Lisaac has a "software-engineering" problem with deferred slots.
The deferred slots are usefull for polymorphism, they are meant to be redefined in child prototypes (lower in type hierarchy), right?

The problem is what happen if the programmer forget to redefine a deferred slot? Currently the program crash at runtime with a "Slot deferred" msg.
Imagine you inherit/expand a big prototype (like ABSTRACT_BITMAP), with deferred slots, there is no way to prove you quickly that you implemented all the deferred slots.
So my question is: is it possible/interesting for the compiler to detect the "deferred call"? like the "call on NULL".

The changes could be:
- deferred <- `18`;
or
- deferred:E <- (`18` ; NULL);

instead of:
- deferred <-
( + ptr:POINTER;
ptr := top_runtime_stack;
crash_on ptr with_message "Slot deferred.";
);

Then the compiler can flag the caller slot as "deferred" in the execution pass. At each slot call the flag is checked, if a lisaac expression call (dynamically) a deferred, an error is print to remind the programmer that the slot has not been redefined.
Maybe it's not so easy ;-)

See you
Damien




More information about the Lisaac-devel mailing list