Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2013-08-20
10:52 • Closed ticket [3487424fff]: Cannot remove all superclasses of a TclOO class ... artifact: 4abac5098b user: dkf
2012-02-14
17:21 • Pending ticket [3487424fff]. artifact: 09356c4f62 user: dkf
2012-02-13
23:20 • New ticket [3487424fff]. artifact: 9f0584a82b user: basilik99

Cannot remove all superclasses of a TclOO class

Closed / Fixed3487424fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 13 years ago
Descriptionplain2012-02-13 23:20:53
Hi,

I use ActiveState Tcl 8.6.0.0.295132 Beta 6.

I have a class with a static method that changes the list of its baseclasses:

self method DISABLE_SUPERCLASSES {} \
{
   oo::define SNAPSHOT_ELEMENT superclass ""
}
self export DISABLE_SUPERCLASSES

This yields the error: " does not refer to an object". TclOO does not accept the empty string.

I might not use the right technique here... But is there a way to remove all superclasses of a given class?

As a workaround, I can create a dummy class and make it its superclass... Or I can use oo::object as the dummy base class.

Thanks,
Etienne
dkfplain2012-02-14 17:21:23
[superclass] takes multiple arguments, one per superclass. You can't say that there is _no_ superclass, as TclOO is a single-rooted class system. You can say that the superclass is oo::object, which will be functionally the same. (You can't set the superclass of oo::object or oo::class; they're special.)
dkfhtml2013-08-20 10:52:43

Current code now enforces that there is always a superclass (it was possible to make this not be the case, which was a catastrophic bug).

Log in (anonymous is fine) to add a comment.