On 2010-12-20, at 16:38, André Bargull wrote: > Some questions for this change set: > - Why <accept> and <present> instead of <method name="accept"> and <method > name="present">?
Because despite all our grand ideas, I can't just tack this onto the class compiler. The class compiler is really a <node>subclass compiler, and has _way_ too much machinery than I was willing to hack around to make this work. Possibly, I could have put <type> above <class> and migrated just the stuff type needs up, but I had to get a fix out today... So... for the time being, I just want to make it very obvious that <type> does not have attributes and methods or any of that machinery, and I was afraid if I looked for just the two method patterns that would confuse people into thinking they could write other methods. This is still a private "in progress" feature. People who use it will need to be prepared to fix their code if we change the API. > - Why is it necessary to pass `node` and `attribute` to accept/present? To be able to implement relative CSS dimensions. I.e., to generally be able to say `75%` as a CSS binding. To calculate what 75% is, you need to know the attribute and node (and look at that attribute in the parent). This is not yet implemented, but I figured I might as well put the machinery there. > On 12/20/2010 11:05 AM, P T Withington wrote: >> Change ptw-20101220-82u by [email protected] on 2010-12-20 04:54:41 EST >> in /Users/ptw/OpenLaszlo/trunk-3 >> for http://svn.openlaszlo.org/openlaszlo/trunk >> >> Summary: Next step in user<type>s >> >> Bugs Fixed: LPP-9589 Unexpected warning information of ''gradient" >> >> Technical Reviewer: [email protected] (pending) >> QA Reviewer: [email protected], [email protected] (pending) >> >> Overview: >> I've hacked in user-defined types. You can now write the gradient >> type as: >> >> <type name="gradient"> >> <accept args="value, node:LzNode, attribute:String"> >> return new lz.CSSGradient(value); >> </accept> >> >> <present args="value, node:LzNode, attribute:String"> >> return value.css; >> </present> >> </type> >> >> I know this is not as general as we wanted, but it's the most I >> can get working on short notice. >> >> Details: >> Basically the types get compiled as very custom classes at resolve time. >> >> Tests: >> Rewrite gradienttype.lzx as above and run house.lzx >> >> Files: >> M WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptClass.java >> M WEB-INF/lps/server/src/org/openlaszlo/compiler/TypeCompiler.java >> M WEB-INF/lps/server/src/org/openlaszlo/compiler/ViewSchema.java >> >> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/ptw-20101220-82u.tar >>
