Index: generic/predefined.xotcl =================================================================== diff -u -rfd82d80829200a3928e29cdfc0d19df6222a9267 -r91e9b1a3b1c3e60a8538156b4aa37d5a664d5133 --- generic/predefined.xotcl (.../predefined.xotcl) (revision fd82d80829200a3928e29cdfc0d19df6222a9267) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision 91e9b1a3b1c3e60a8538156b4aa37d5a664d5133) @@ -4,6 +4,11 @@ puts stderr "::xotcl::setrelation is deprecated, use '::xotcl::relation $args' instead" uplevel ::xotcl::relation $args } + + # first we create the ::oo:: object system. Actually, we do not need it. + namespace eval ::oo {} + ::xotcl::createobjectsystem ::oo::object ::oo::class + if {[info command ::oo::object] ne ""} { # When the system shuts down, destroy is called for every # available object. When ::xotcl::Object and ::xotcl::Class are @@ -14,38 +19,42 @@ # ::xotcl::alias ::oo::object destroy ::xotcl::cmd::Object::destroy ::xotcl::alias ::oo::class instdestroy ::xotcl::cmd::Class::instdestroy + # - # Perform the basic setup of XOTcl. First, let us allocate objects - # and classed via the method named "alloc". + # Perform the basic setup of XOTcl. First, let us allocate the + # basic classes of XOTcl. This call creates the classes + # ::xotcl::Object and ::xotcl::Class and defines these as root + # class of the object system and as root meta class. # - ::xotcl::alias ::oo::class alloc ::xotcl::cmd::Class::alloc + ::xotcl::createobjectsystem ::xotcl::Object ::xotcl::Class + +# foreach o {::xotcl::Object ::xotcl::Class} { +# foreach r {object class metaclass} { +# puts stderr "$o $r=[::xotcl::is $o $r]" +# } +# } + # - # Create the basic Classes of XOTcl ... + # createobjectsystem creates already the relation that Class has Object as + # superclass. We could define this here as well. # - ::oo::class alloc ::xotcl::Object - ::oo::class alloc ::xotcl::Class - #foreach o {::xotcl::Object ::xotcl::Class} { - # foreach r {object class metaclass} { -# puts stderr "$o $r=[::xotcl::is $o $r]" -# } -# } +# puts stderr sc(class)=[::xotcl::relation ::xotcl::Class superclass] +# ::xotcl::relation ::xotcl::Class superclass ::xotcl::Object + # - # ... and define the superclass and class relations on these. + # createobjectsystem creates already the relation that Object and + # Class are instances of Class. We could define this here as well. # - ::xotcl::relation ::xotcl::Class superclass ::xotcl::Object - ::xotcl::relation ::xotcl::Class metaclass - - # puts "Now class should be a metaclass" - # foreach o {::xotcl::Class} { - # foreach r {object class metaclass} { -# puts stderr "$o $r=[::xotcl::is $o $r]" - # } - #} - ::xotcl::relation ::xotcl::Object class ::xotcl::Class - ::xotcl::relation ::xotcl::Class class ::xotcl::Class +# puts stderr cl(object)=[::xotcl::relation ::xotcl::Object class] +# puts stderr cl(class)=[::xotcl::relation ::xotcl::Class class] +# ::xotcl::relation ::xotcl::Object class ::xotcl::Class +# ::xotcl::relation ::xotcl::Class class ::xotcl::Class } - # by setting this variable, we can check later, whether we are in - # bootstrapping mode + + # + # By setting the variable bootstrap, we can check later, whether we + # are in bootstrapping mode + # set bootstrap 1 # provide the standard command set for ::xotcl::Object @@ -67,11 +76,9 @@ # # create class and object for nonpositional argument processing ::xotcl::Class create ::xotcl::NonposArgs - foreach cmd [info command ::xotcl::cmd::NonposArgs::*] { ::xotcl::alias ::xotcl::NonposArgs [namespace tail $cmd] $cmd } - ::xotcl::NonposArgs create ::xotcl::nonposArgs ########################