> Example code for using signals to reduce the need for rtti or
> inset codes.  No need to identify insets,  they identify themselves by
> connecting to appropriate signals.  This scheme means we don't have
> to scan a buffer looking for particular inset types.
> 
> NOTE: this doesn't solve all problems related to special case handling
>       of insets.  Those special cases remaining can be eliminated
>       by a homomorphic hierarchy: remember the main reason we need
>       to identify a particular inset is so we can call a method that
>       only it supports.  If all insets support that method but default
>       to no action we no longer need special case testing.  We
>       shouldn't just spread existing methods across all insets though
>       we need to identify real special case instances and plan better
>       since we might be able to avoid that special case in better ways.

That was pretty neat code.
The only negative thing I can say about it is that the Buffer will be cluttered
with signals, and we don't want that...

What about using a similar technique, but in a higher level fashion?
Instead of having customized signals for every little thing, we will instead
have a generic Variable-system, a generic Function-system, and a generic
Scoping system.
Together, this will define a very general storage facility, and with this, we
can do all sorts of general things.
So, we will define a bunch of Variables, and a bunch of Functions that can be
applied to all insets in a document in one go.  By giving each Inset a specific
Scope, we can target exactly the Insets we want to, and hopefully do all these
queries with only one interface.
It's just a rough idea, and it needs some more thought, but I thought that I'd
just throw it into the air.

The Functions would be first-class Values, and then we have a system, maybe
like this:

struct Value {
        union {
        int i;
        string s;
        Function f;
        };
        enum Tag {
        integer_value, string_value, function_value
        };
        Tag tag;
};

struct Scope {
        string name;
        // Maybe some more here
};

struct Variable {
        Value value;
        Scope scope;
        Name name;
};

Then we would have a method "apply" in all insets, that would take a Function
and apply it to some passed Variable.

The idea is to do something higher-level that is very general, and hooks nicely
into a scripting language.  Anyway, just a thought...

Greets,

Asger

Reply via email to