> > It may make sense to pass a leading argument to TIE which is the type
   > > of variable being tied.
   > > 
   > >     tie Some::Class $foo, @args;
   > > 
   > > would produce:
   > > 
   > >     TIE('SCALAR', 'Some::Class', @args);

Or, better still, pass a reference to the actual variable being tied.
That is:

        tie Some::Class $foo, @args;
    
    would produce the effect of:

        Some::Class->TIE(\$foo, @args);

    whilst:
    
        tie Some::Class @foo, @args;
    
    would produce the effect of:

        Some::Class->TIE(\@foo, @args);


That way you can still get the underlying type if you need it --
via C<ref($_[0])> -- but more importantly, you can get the previous
*value* of the variable, or a reference to it, so that your tied
variable can remember it.

That ability is very important when using tied variables as proxies
and is one of the major pains of the existing mechanism.

Also notice that I suggested the TIE be called as a method,
so that it can be inherited if necessary (maybe you had that idea
already???)

Damian

Reply via email to