[Laszlo-dev] My change for override doesn't catch this, case

André Bargull a.bargull at intensis.de
Fri Mar 28 15:43:58 PDT 2008


AS3 does not support abstract classes, and I did not found any reference 
to abstract classes in the ES4-overview 
("http://www.ecmascript.org/es4/spec/overview.pdf").
And yes, I think adding a layout-interface would be a good idea:

interface ILayout {
  function reset( e = null );
  function addSubview( sd );
  function removeSubview( sd );
  function ignore( s );
  function update( e = null );
}

I've just took all function from LzLayout which are marked as 
"protected". Missed anything, (apart from a better interface name, maybe 
less java-like...)?

On 3/28/2008 11:05 PM, P T Withington wrote:
> We discussed this before.  We should just say:
>
> function update(...rest) {
>   if($debug) {
>     Debug.error("Subclasses of layout must define an update method");
>   }
> }
>
> I don't recall whether AS3/JS2 support abstract classes, but maybe 
> layout could be an interface, and that would be close enough?
>
> On 2008-03-28, at 17:58 EDT, André Bargull wrote:
>>> /**
>>>  * Update is called whenever the layout needs to be updated. By 
>>> defualt, it
>>>  * is called by <b> reset</b>. This is an abstract function in the 
>>> class,
>>>  * but this is the main routine where the layout does its work.
>>>  *
>>>  * The beginning of this routine should always check for the locked 
>>> property
>>>  * and return immediately if it is true for best performace.
>>>  *
>>>  * @access protected
>>>  */
>>> /*
>>> function update() {
>>> }
>>> */
>> That is in "LzLayout.lzs", I guess you want to uncomment it. Hm, do 
>> we support "abstract classes" yet?
>> Because LzLayout is actually an abstract class, any layout class must 
>> implement this "update" method.
>>
>>> Hey, this just worked! <method name="update" args="...rest"> now 
>>> simplelayout is working ,I'll check in the changes On undefined, 
>>> Henry Minsky <henry.minsky at gmail.com> wrote:
>>>> > OK, more progress.
>>>> >
>>>> > Now, here's an issue, whenever there is a method which is 
>>>> registered to be
>>>> > called by an event handler,
>>>> > such as "update" or "__parentInit" in LzLayout, the sendEvent 
>>>> expects it
>>>> > to take an argument.
>>>> >
>>>> >         this.initDelegate = new LzDelegate( this , "__parentInit",
>>>> > this.immediateparent, "oninit" );
>>>> >
>>>> > In LzLayout, there is a method called "update" which is 
>>>> registered to be
>>>> > an event handler through some contorted
>>>> > and scary looking mechanism where it pushes it on a list named 
>>>> "delegates"
>>>> >
>>>> >
>>>> >     this.updateDelegate = new LzDelegate( this , "update" );
>>>> >
>>>> >     this.delegates = [ this.updateDelegate ];
>>>> >
>>>> >
>>>> > and then LzLayout overrides constructWithArgs
>>>> >
>>>> > override function constructWithArgs ( args ) {
>>>> >
>>>> >
>>>> > SO anyway, in simplelayout, a user-defined class, it defines a 
>>>> method
>>>> > named "update", with no args
>>>> >
>>>> >     <method name="update">
>>>> >
>>>> > So, I think we need a way to specify optional or default args in 
>>>> the args
>>>> > list to a <method> declaration, like maybe
>>>> >
>>>> > <method name="update" args="v=null" >
>>>> >
>>>> > or
>>>> >
>>>> > <method name="update" args="...rest">
>>>> >
>>>> > ??
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > On undefined, Henry Minsky <henry.minsky at gmail.com> wrote:
>>>> >
>>>>
>>>>> > > Oh, I put addSubview  on LzView in the schema, but LzLayout 
>>>>> extends
>>>>> > > LzNode, and defines its own addSubview method.
>>>>> > > So i need to put it on LzLayout in the schema.
>>>>> > >
>>>>> > > Sigh, I guess we'll be finding some more of these for a while 
>>>>> cuz I did
>>>>> > > this manually.
>>>>> > >
>>>>> > >
>>>>> > > On undefined, Henry Minsky <henry.minsky at gmail.com> wrote:
>>>>> > >
>>>>>
>>>>>> > > > It looks like it is. I'm wondering if I have code that is only
>>>>>> > > > checking the immediate superclass for the existence of
>>>>>> > > > an attribute instead of all the way up the chain or 
>>>>>> something. Time
>>>>>> > > > for some print statements..
>>>>>> > > >
>>>>>> > > >
>>>>>> > > > On undefined, P T Withington <ptw at pobox.com> wrote:
>>>>>> > > >
>>>>>>
>>>>>>> > > > > You're sure LzNode#addSubview is in the schema?
>>>>>>> > > > >
>>>>>>> > > > > On 2008-03-28, at 16:40 EDT, Henry Minsky wrote:
>>>>>>>
>>>>>>>> > > > > > Hmm, the new code to check for overrides is failing 
>>>>>>>> to catch this
>>>>>>>> > > > > > case where
>>>>>>>> > > > > > simplelayout overrides the LzView addSubview method.
>>>>>>>> > > > > >
>>>>>>>> > > > > > I better put some tracing in to see why it doesn't 
>>>>>>>> identify this
>>>>>>>>
>>>>>>> > > > > as
>>>>>>>
>>>>>>>> > > > > > a method
>>>>>>>> > > > > > of a superclasss...
>>>>>>>> > > > > >
>>>>>>>> > > > > >
>>>>>>>> > > > > > Compiling: hello-layout.lzx to hello-layout.lzr=swf9.swf
>>>>>>>> > > > > > writing script to /tmp/lzx-script.js
>>>>>>>> > > > > > Executing compiler: (cd /tmp/lzswf9/lzgen55753;
>>>>>>>>
>>>>>>> > > > > /Users/hqm/flex3/bin/
>>>>>>>
>>>>>>>> > > > > > mxmlc
>>>>>>>> > > > > > -compiler.show-actionscript-warnings=false
>>>>>>>> > > > > > -compiler.source-path+=/tmp/lzswf9/lzgen55753 
>>>>>>>> -debug=true -output
>>>>>>>> > > > > > /tmp/lzswf9/lzgen55753/app.swf -default-size 800 600
>>>>>>>> > > > > >
>>>>>>>>
>>>>>>> > > > > 
>>>>>>> -library-path+=/Users/hqm/openlaszlo/trunk4/lps/includes/lfc/LFC9.swc 
>>>>>>>
>>>>>>>
>>>>>>>> > > > > > /tmp/lzswf9/lzgen55753/LzApplication.as)
>>>>>>>> > > > > > compiler output:
>>>>>>>> > > > > > Loading configuration file
>>>>>>>> > > > > > 
>>>>>>>> /Users/hqm/openlaszlo/adobe/trunk/frameworks/flex-config.xml
>>>>>>>> > > > > >
>>>>>>>> > > > > > ERRORS:
>>>>>>>> > > > > > Compiler error: at [/tmp/lzswf9/lzgen55753/$lzc
>>>>>>>> > > > > > $class_simplelayout.as: 38]:
>>>>>>>> > > > > > Error: Overriding a function that is not marked for 
>>>>>>>> override.
>>>>>>>> > > > > >
>>>>>>>> > > > > > function addSubview (newsub) {
>>>>>>>> > > > > >         ^
>>>>>>>> > > > > >
>>>>>>>> > > > > > FAIL: compiler returned 1
>>>>>>>> > > > > > Done executing compiler
>>>>>>>> > > > > > Intermediate file /tmp/lzswf9/lzgen55753/app.swf: 
>>>>>>>> does not exist
>>>>>>>> > > > > > Compilation errors occurred:
>>>>>>>> > > > > >
>>>>>>>> > > > > > --
>>>>>>>> > > > > > Henry Minsky
>>>>>>>> > > > > > Software Architect
>>>>>>>> > > > > > hminsky at laszlosystems.com
>>>>>>>>
>>>>>>> > > > >
>>>>>>> > > > >
>>>>>>>
>>>>>> > > >
>>>>>> > > >
>>>>>> > > > --
>>>>>> > > > Henry Minsky
>>>>>> > > > Software Architect
>>>>>> > > > hminsky at laszlosystems.com
>>>>>> > > >
>>>>>> > > >
>>>>>>
>>>>> > >
>>>>> > >
>>>>> > > --
>>>>> > > Henry Minsky
>>>>> > > Software Architect
>>>>> > > hminsky at laszlosystems.com
>>>>> > >
>>>>> > >
>>>>>
>>>> >
>>>> >
>>>> > --
>>>> > Henry Minsky
>>>> > Software Architect
>>>> > hminsky at laszlosystems.com
>>>> >
>>>> >
>>>>
>>>
>>>
>>> -- Henry Minsky Software Architect hminsky at laszlosystems.com
>>
>
>


More information about the Laszlo-dev mailing list