Hi Mark,

>> There is actually a pretty good example in the incubator.  

Your example worked a treat. I used that to correct my test code. This code
doesn't do anything but trace paths up the hierarchy for each of an RcDialog
path a ResDialog path.  FYI, the code is below, and the console output is
after that.
A summary of findings (as it were) is as follows:

The desired hierarchies are: 
    CustomerView --> RcView  --> RcDialog  -->
    ProductView  --> ResView --> ResDialog -->
RcView and ResView are empty, and are actually implemented by the mixin
(RcResMixin). 
So the effective hierarchy should be:
    CustomerView --> RcResMixin --> RcDialog  -->
    ProductView  --> RcResMixin --> ResDialog -->
However, this sequence only appears when I use 'self~<method>:super'
When I use 'forward class (super) continue', I get the sequence:
    CustomerView --> RcDialog  --> RcResMixin -->
    ProductView  --> ResDialog --> RcResMixin -->

I can't immediately see an explanation for this difference (but it is
11:35pm here...). 

Atb,
Oliver

============================================================================
==================

Code (filename 'TestMixinsMark.rex):
=====

/* Test mixins based on Mark's ListViewEx.rex */
say
say "Comment: Effective Hierarachies are:"
say "   CustomerView --> RcView  --> RcDialog  --> PlainBaseDialog"
say "   ProductView  --> ResView --> ResDialog --> PlainBaseDialog"
say "   (Note: PlanBaseDialog only appears in test 1.)"
cust = .CustomerView~new
prod = .ProductView~new
say; say "-----------"
say "  Using 'forward class (super) continue' up the hierarchy:"
cust~doit1      -- "forward class (super) continue" up the hierarchy
say
prod~doit1      -- "forward class (super) continue" up the hierarchy
say; say "-----"
say "  Using 'self~doIt2x:super' up the hierarchy (where 'x' = 'a', 'b',
'c'):"
cust~doIt2a
say
prod~doIt2a
say; say "-----"
say "  Method invoked on the bottom class, but method exists only at top:"
cust~doIt3
say
prod~doIt3
say "----------"

::class PlainBaseDialog
  ::method doIt1
    say "PlainBaseDialog-doIt."

-- ooDialog's superclasses:
::class RcDialog subclass PlainBaseDialog
  ::method doIt1;   say "RcDialog-doIt1."; forward class (super) continue
  ::method doIt2c;  say "RcDialog-doIt2c."
  ::method doIt3;   say "RcDialog-doIt3."

::class ResDialog subclass PlainBaseDialog
  ::method doIt1;   say "ResDialog-doIt1."; forward class (super) continue
  ::method doIt2c;  say "ResDialog-doIt2c."
  ::method doIt3;   say "ResDialog-doIt3."

-- My "framework" classes:
::class ResView subclass ResDialog inherit RcResMixin
::class RcView  subclass RcDialog  inherit RcResMixin

-- The mixin class:
::class RcResMixin public mixinclass PlainBaseDialog
  ::method doIt1
    say "RcResMixin-doIt1."
    forward class (super) continue
  ::method doIt2b
    say "RcResMixin-doIt2b."
    -- say "RcResMixin-doIt2b: - self / super =" self "/" super
    -- Note: self = "a CUSTOMERVIEW", super = "The PLAINBASEDIALOG class".
    self~doIt2c
    --self~doIt2c:super

-- My "application" classes:
::class CustomerView subclass RcView -- methods in RcResMixin
  ::method doIt1
    say "CustomerView-doIt1."
    forward class (super) continue
  ::method doIt2a
    say "CustomerView-doIt2a."
    self~doIt2b:super

::class ProductView  subclass resView -- methods in RcResMixin
  ::method doIt1
    say "ProductView-doIt1."
    forward class (super) continue
  ::method doIt2a
    say "ProductView-doIt2a."
    self~doIt2b:super




Console Output:
===============
D:\...>testmixinsMark

Comment: Effective Hierarachies are:
   CustomerView --> RcView  --> RcDialog  --> PlainBaseDialog
   ProductView  --> ResView --> ResDialog --> PlainBaseDialog
   (Note: PlanBaseDialog only appears in test 1.)

-----------
  Using 'forward class (super) continue' up the hierarchy:
CustomerView-doIt1.
RcDialog-doIt1.
RcResMixin-doIt1.
PlainBaseDialog-doIt.

ProductView-doIt1.
ResDialog-doIt1.
RcResMixin-doIt1.
PlainBaseDialog-doIt.

-----
  Using 'self~doIt2x:super' up the hierarchy (where 'x' = 'a', 'b', 'c'):
CustomerView-doIt2a.
RcResMixin-doIt2b.
RcDialog-doIt2c.

ProductView-doIt2a.
RcResMixin-doIt2b.
ResDialog-doIt2c.

-----
  Method invoked on the bottom class, but method exists only at top:
RcDialog-doIt3.

ResDialog-doIt3.
----------

============================================================================
========


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to