Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added a hook to ensure ancestors classes for every instanted object also cement their ensembles Added tests to ensure that ancestor ensembles are accessible from [next] and also that ensemble methods inherit in a method-like order |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f3b84e34157ca42be689b71887443668 |
User & Date: | tne 2016-10-19 16:12:30 |
Context
2016-11-06
| ||
12:35 | Updating the units package to utilize features of 8.5 and to do non-absolute unit changes (for instance kelvin->celsius) check-in: c5e59c65be user: hypnotoad tags: trunk | |
2016-10-19
| ||
16:12 | Added a hook to ensure ancestors classes for every instanted object also cement their ensembles Added tests to ensure that ancestor ensembles are accessible from [next] and also that ensemble methods inherit in a method-like order check-in: f3b84e3415 user: tne tags: trunk | |
16:10 | Added a hook to ensure ancestors classes for every instanted object also cement their ensembles Added tests to ensure that ancestor ensembles are accessible from [next] and also that ensemble methods inherit in a method-like order check-in: 58677f3949 user: tne tags: odie | |
12:31 | Added checks in oometa to prevent errors for classes that define no metadata Added better handling of ensembles for cases of mixins and morphs Added an automatic rebuild of metadata prior to building dynamic methods for a class Added tests for these new behaviors in tool check-in: 6cda9ff384 user: hypnotoad tags: trunk | |
Changes
Changes to modules/tool/ensemble.tcl.
︙ | ︙ | |||
105 106 107 108 109 110 111 | } } set ::tool::dirty_classes {} ### # Only go through the motions for classes that have a locally defined # ensemble method implementation ### | > | | | | | | | | | > | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | } } set ::tool::dirty_classes {} ### # Only go through the motions for classes that have a locally defined # ensemble method implementation ### foreach aclass [::oo::meta::ancestors $thisclass] { if {[info exists ::tool::obj_ensemble_cache($aclass)]} continue set emap [::tool::ensemble_build_map $aclass] set body [::tool::ensemble_methods $emap] oo::define $aclass $body # Define a property for this ensemble for introspection foreach {ensemble einfo} $emap { ::oo::meta::info $aclass set ensemble_methods $ensemble: [lsort -dictionary [dict keys $einfo]] } set ::tool::obj_ensemble_cache($aclass) 1 } } ### # topic: ec9ca249b75e2667ad5bcb2f7cd8c568 # title: Define an ensemble method for this agent ### ::proc ::tool::define::method {rawmethod args} { |
︙ | ︙ |
Changes to modules/tool/tool.test.
︙ | ︙ | |||
495 496 497 498 499 500 501 | } {::noop} MorphOrganObject#4 mixin OrganClass test tool-constructor-args-006 {Test that a default for an organ option is NOT applied if the graft exists during a mixin} { MorphOrganObject#4 organ db } {::DbObj} | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | } {::noop} MorphOrganObject#4 mixin OrganClass test tool-constructor-args-006 {Test that a default for an organ option is NOT applied if the graft exists during a mixin} { MorphOrganObject#4 organ db } {::DbObj} ### # Test ensemble inheritence ### tool::define NestedClassA { method do::family { return [self class] } method do::something { return A } method do::whop { return A } } tool::define NestedClassB { superclass NestedClassA method do::family { set r [next family] lappend r [self class] return $r } method do::whop { return B } } tool::define NestedClassC { superclass NestedClassB method do::somethingelse { return C } } tool::define NestedClassD { superclass NestedClassB method do::somethingelse { return D } } tool::define NestedClassE { superclass NestedClassD NestedClassC } tool::define NestedClassF { superclass NestedClassC NestedClassD } NestedClassC create NestedObjectC test tool-ensemble-001 {Test that an ensemble can access [next] even if no object of the ancestor class have been instantiated} { NestedObjectC do family } {::NestedClassA ::NestedClassB ::NestedClassC} test tool-ensemble-002 {Test that a later ensemble definition trumps a more primitive one} { NestedObjectC do whop } {B} test tool-ensemble-003 {Test that an ensemble definitions in an ancestor carry over} { NestedObjectC do something } {A} NestedClassE create NestedObjectE NestedClassF create NestedObjectF test tool-ensemble-004 {Test that ensembles follow the same rules for inheritance as methods} { NestedObjectE do somethingelse } {D} test tool-ensemble-005 {Test that ensembles follow the same rules for inheritance as methods} { NestedObjectF do somethingelse } {C} # ------------------------------------------------------------------------- testsuiteCleanup # Local variables: |
︙ | ︙ |