## ŒMIXIN Mix another class into object

Implemented for Internal classes only (but right argument can be External or System class).

Syntax:

{arch} objref.ŒMIXIN Class Arg1 Arg2..
mixin_ref „ {arch} objref.ŒMIXIN Class Arg1 Arg2..
{arch} ŒMIXIN Class Arg1 Arg2.. (Within user-defined method, same as ŒTHIS.ŒMIXIN)
mixin_ref „ {arch} ŒMIXIN Class Arg1 Arg2.. "

The System Method ŒMIXIN allow you to mix another class into an object. This has the effect of adding the properties and methods of the mixin to the main object. The mixin can be another internal (APL class), or a system class (such as `Window`), or an external class (.Net, Java, etc).

ŒMIXIN has a similar syntax to ŒNEW; the right argument is the class reference (or name, as a text vector), followed by any arguments to the constructor for the class you are mixing-in. The left argument can be omitted if you are mixing-in an APL class, otherwise it defines the architecture for the mix-in. For example:

          © Mix in an APL class, no arguments to constructor
          inv.Œmixin Fax

          © Mix in a Java class, no arguments to constructor
          'java' inv.Œmixin 'java.util.Date'

          © Mix in a .Net class, with arguments to constructor
          '.net' inv.Œmixin 'DateTime' 2004 5 6

          inv.Œmixins
    [Fax] [java:Date] [.net:DateTime]

The explicit result of ŒMIXIN is the underlying object reference which has been mixed in to the object, but with display potential switched off. (In other words it is a 'shy' or non-printing result). You can assign this to a variable or property of your APL class, and use this to call the underlying object directly:

          jd„'java' inv.Œmixin 'java.util.Date'
          jd.Œclassname
    java:java.util.Date

See the section on Mixins for more information.

Topic: APLX Help : Help on APL language : System Methods : ŒMIXIN Mix another class into object

[ Previous | Next | Contents | Index ]