And what about (I don't want to say "dynamic", because it'd be ambiguous concerning AS3) classes like "drawview"? There is heavy use of "addProperty(..)" to add dynamically functions are runtime.

For classes, we can eventually make it
so that all the methods and handlers (including the anonymous ones)
are declared at compile time in
a class declaration.

But what about views (i.e., instances rather than class declarations).
Maybe we say that they cannot
reference super() in their methods or handlers? That would be  kind of
confusing. Especially as we
promote this style of programming where you first make methods on your
instance, and then
convert it to a class later. If you can't refer to super() in your
methods, you're somewhat restricted
for more sophisticated programming.


If a view has some methods or handlers declared, they get stuck into
the initial attributes list
as functions, like

    <view bgcolor="blue" width="40" height="40"
          x="59" y="59"
          onclick="this.setAttribute('x', 10);
                   this.setAttribute('y', 10)"/>

{$delegates: ["onclick", "$m3", null], $m3: function
        $hello$2Elzx_15_50_$m3 () {
        this.setAttribute('x', 150);
        this.setAttribute('y', 10)
            },


One thought I had at one point was to convert every view that declares
methods or handlers into
a singleton class declaration, that seems like a pretty major step,
but maybe it's necessary!


Another thought;
I guess  that for each user-class, the compiler could collect up all
the methods that are declared on all instances of that class,
and carefully map them to unique names and define them on the class,
but that seems a little
awkward. That seems even worse that making a singleton class for
instances that define methods.



On Jan 8, 2008 9:49 AM, P T Withington <[EMAIL PROTECTED] wrote:
 That's a good question.  You would have to test if super will work.
 My guess would be that it will not because I would think that only
 'fixed' methods could participate in the class structure (i.e., that
 the super method is computed at compile time).

 Isn't this only needed because the tag compiler is not emitting class
 declarations?  I would hope that when the tag compiler emits class
 declarations, it would declare all the methods.


 On 2008-01-08, at 09:26 EST, Henry Minsky wrote:


  The (Laszlo) Class.addProperty method is used by LzNode to install
  methods dynamically.
  I've got it implemented just as
function addProperty(key:*,val:*):void {
         this[key] = val;
     }
in the LzNode swf9 development world right now. Is there anything
  else we need to when adding functions at runtime that refer to
  superclass methods (or "super()" )
  or will that "just work"?
--
  Henry Minsky
  Software Architect
  [EMAIL PROTECTED]






-- Henry Minsky Software Architect [EMAIL PROTECTED]

Reply via email to