|
|
|
[
Permlink
| « Hide
]
Jim Grandy - 22/Aug/06 04:43 PM
We need to either fix this or wait on CSS integration.
As part of this, remove all uses of the term 'trait/inherits' from LFC/Compiler/LZX, replace with 'mixin/with'.
See also
If this is feasible for Ringding, IWBRN to have
I was initially thinking this would be trivial, it would just be XML that translated directly to JS. But I bet that is not what people will have in mind at all. I bet they will be thinking they can write anything that they can write in a <class> tag (like constraints, setters, handlers, events) and have those correctly 'mixed in' to their class. I'm not sure I want to open that can of worms. Is this really a feature that users need? We added mixins to our JS because we needed them to implement the LFC, but I haven't heard a crying need for these at the LZX level.
r11630 | ptw | 2008-10-28 16:45:21 -0400 (Tue, 28 Oct 2008) | 21 lines
Changed paths: M /openlaszlo/trunk/WEB-INF/lps/lfc/compiler/Class.lzs M /openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs M /openlaszlo/trunk/WEB-INF/lps/lfc/glue/LaszloInitiator.lzs M /openlaszlo/trunk/WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/js2doc/PropertyReference.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CommonGenerator.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9ParseTreePrinter.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptCompiler.java Change 20081028-ptw-u by ptw@dueling-banjos.home on 2008-10-28 14:30:21 EDT in /Users/ptw/OpenLaszlo/trunk for http://svn.openlaszlo.org/openlaszlo/trunk Summary: Replace `trait` with `mixin` Bugs Fixed: Technical Reviewer: dda@ddanderson.com (Message-Id: <F85D0082-2BF5-437B-A86F-69F77AF77FC6@ddanderson.com>) QA Reviewer: max (pending) Details: Just stamping out the use of `trait`, which we decided was inaccurate, with its approved replacement `mixin`. Also removed the obsolete `inherits` synonym for `with`. Tests: smokecheck I have a very rough draft of this working, taking a completely different tack: Instead of trying to translate an LZX mixin to a JS mixin, I take the same approach as for JS, but at the LZX level. To wit: when I see an LZX <class> that has a 'with' property, I iterate through the list of mixin's, cloning them and re-jiggering them to represent the 'interstitial', that is I create 'anonymous' classes that are copies of the mixin, inserted into the correct spot in the class heirarchy. These anonymous classes are inserted into the LZX DOM at schema creation time, and will subsequently be compiled into JS classes.
Thus, an LZX mixin becomes effectively a macro for defining a class that adds all the properties of the mixin (everything, attributes, methods, events, handlers, setters, children, constraints, etc.) to an intermediate class that inherits from the superclass and becomes the superclass of the class being defined. It's somewhat dangerous, because it gives the LZX programmer a _significant_ amount of rope. Used judiciously, it will be very powerful, but used inexpertly, it will be a disaster. r11841 | ptw | 2008-11-20 11:23:14 -0500 (Thu, 20 Nov 2008) | 67 lines
Changed paths: M /openlaszlo/trunk/WEB-INF/lps/lfc/core/LzConstants.lzs M /openlaszlo/trunk/WEB-INF/lps/schema/lfc-undeclared.lzx M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassCompiler.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/Compiler.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ElementWithLocationInfo.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/InterfaceCompiler.java A /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/MixinCompiler.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ViewSchema.java M /openlaszlo/trunk/lps/components/base/colors.lzx A /openlaszlo/trunk/test/mixins.lzx Change 20081118-ptw-u by ptw@dueling-banjos.home on 2008-11-18 17:14:04 EST in /Users/ptw/OpenLaszlo/trunk for http://svn.openlaszlo.org/openlaszlo/trunk Summary: First pass at <mixin> New Features: <mixin> Bugs Fixed: Technical Reviewer: max (pending) QA Reviewer: hminsky (verbal) Doc Reviewer: lou@louiorio.com (pending) Documentation: <mixin> is like <class> but rather than creating something you can instantiate, creates a template that can be 'mixed in' (added to) more than one other class. A <mixin> is like an interface, but it is allowed to have state and implementation. <mixin> is an advanced feature. To add a mixin to a class you say: <class name="icecream" ... /> <class name="walnuts" ... /> <mixin name="toppings"> <attribute name="sauce" type="color" value="lavender" /> <attribute name="whippedcream" type="boolean" value="true" /> <attribute name="cherry" type="boolean" value="true" /> ... </mixin> <class name="sundae" extends="icecream" with="toppings /> <sundae name="chocfulla" flavor="honeydew" sauce="lemonchiffon"> <walnuts ground="true" /> </sundae> See tests/mixins.lzx for a more complete example Details: test/mixins: An example using classes and mixins lfc-undeclared: Add <mixin> LzConstants, ViewSchema: Update color tokes to CSS3 standard ClassCompiler: Learn how to create interstitial <nodes>, insert them into the schema. Compiler, MixinCompiler: For now, just compiles the mixin as a class. NodeModel: Only classes can have `extends` or `with` attributes. ElementWithLocationInfo: Support cloning of elements (to make mixin interstitials). Tests: smokecheck, test/classes.lzx (trunk 4 build r11853)
Tucker, Can you reply in this bug? Thanks, Mamye Results of testing: Is this okay? WEB-INF/lps/schema/lfc-undeclared.lzx --> has <element>traits<element> I'm guessing this is not ok? test/classes.lzx?debug=true&lzr=swf9 compiles successfuly test/classes.lzx?debug=true&lzr=dhtml fails to compile (spins) test/classes.lzx?debug=true&lzr=swf9 fails to display text r12023 | ptw | 2008-12-09 09:21:02 -0500 (Tue, 09 Dec 2008) | 24 lines
Changed paths: M /openlaszlo/trunk/WEB-INF/lps/schema/lfc-undeclared.lzx M /openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx M /openlaszlo/trunk/test/classes.lzx M /openlaszlo/trunk/test/lfc/states.lzx Change 20081206-ptw-c by ptw@dueling-banjos.home on 2008-12-06 12:17:44 EST in /Users/ptw/OpenLaszlo/trunk for http://svn.openlaszlo.org/openlaszlo/trunk Summary: Review comments on r11841 Bugs Fixed: Technical Reviewer: mamye@comcast.net (pending) Details: classes: remove call to non-existent method states: rewrite in the modern way lfc-undeclared: trait -> mixin replicator: silence warning Tests: classes.lzx, mixins.lzx, lfc/states.lzx |
||||||||||||||||||||||||||||||||||||||||||||||||||||||