[Laszlo-checkins] r11954 - openlaszlo/trunk/docs/src/developers

lou@openlaszlo.org lou at openlaszlo.org
Tue Dec 2 04:15:15 PST 2008


Author: lou
Date: 2008-12-02 04:14:53 -0800 (Tue, 02 Dec 2008)
New Revision: 11954

Modified:
   openlaszlo/trunk/docs/src/developers/classes-powerprogramming.dbk
Log:
Change 20081202-lou-1 by lou at loumac.local on 2008-12-02 08:06:38 AST
    in /Users/lou/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: dguide, Chapter 33. Extending Classes: add section 4. <mixin>s 

Bugs Fixed: LPP-5062

Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: tucker

Details: add Tucker's documentation section from LPP-2302    

Tests: visual verify



Modified: openlaszlo/trunk/docs/src/developers/classes-powerprogramming.dbk
===================================================================
--- openlaszlo/trunk/docs/src/developers/classes-powerprogramming.dbk	2008-12-02 12:13:49 UTC (rev 11953)
+++ openlaszlo/trunk/docs/src/developers/classes-powerprogramming.dbk	2008-12-02 12:14:53 UTC (rev 11954)
@@ -274,13 +274,42 @@
 <para>
 will not have classroot defined.</para>
 
+<para/></section></section>
+   <section id="mixins">
+      <title><literal>&lt;mixin&gt;</literal>s</title>
+      <para><literal>&lt;mixin&gt;</literal> is like <literal>&lt;class&gt;</literal>
+         but rather than creating something you can instantiate, <literal>&lt;mixin&gt;</literal> creates a template that can be
+         <emphasis>mixed in</emphasis> (added to) more than one other class. A
+         <literal>&lt;mixin&gt;</literal> is like an interface, but it is allowed to have
+         state and implementation. </para>
+      
+      <para><literal>&lt;mixin&gt;</literal> is an advanced feature. To add a
+         <literal>&lt;mixin&gt;</literal> to a class you say: </para>
+      
+<programlisting>
+   &lt;class name=&quot;icecream&quot; ... /&gt; 
+   &lt;class name=&quot;walnuts&quot; ... /&gt; 
+   
+   &lt;mixin name=&quot;toppings&quot;&gt; 
+      &lt;attribute name=&quot;sauce&quot; type=&quot;color&quot; value=&quot;lavender&quot; /&gt; 
+      &lt;attribute name=&quot;whippedcream&quot; type=&quot;boolean&quot; value=&quot;true&quot; /&gt; 
+      &lt;attribute name=&quot;cherry&quot; type=&quot;boolean&quot; value=&quot;true&quot; /&gt; 
+      ... 
+   &lt;/mixin&gt; 
+   
+   &lt;class name=&quot;sundae&quot; extends=&quot;icecream&quot; with=&quot;toppings /&gt; 
+   
+   &lt;sundae name=&quot;chocfulla&quot; 
+      flavor=&quot;honeydew&quot; 
+      sauce=&quot;lemonchiffon&quot;&gt; 
+      &lt;walnuts ground=&quot;true&quot; /&gt; 
+   &lt;/sundae&gt; </programlisting>
+      
+      <para>See <literal>tests/mixins.lzx</literal> for a more complete example.</para>
+   </section>
 
+<section><title>Declared text</title>
 
-
-
-
-<para/></section></section><section><title>Declared text</title>
-
 <para>The <indexterm><primary>text</primary></indexterm><sgmltag class="element">&lt;text&gt;</sgmltag><remark role="fixme">[unknown tag]</remark>
 <!--unknown tag: text-->
  and <indexterm><primary>inputtext</primary></indexterm><sgmltag class="element">&lt;inputtext&gt;</sgmltag><remark role="fixme">[unknown tag]</remark>



More information about the Laszlo-checkins mailing list