good one tucker.

A

On May 8, P T Withington wrote:

> You can check for the presence of optional arguments using arguments.length.
> This is my idiom for giving default values to optional arguments:
> 
> function (arg1, arg2, opt1, opt2, opt3) {
>  switch (arguments.length) {
>    case 0: case 1:
>      Debug.error("Missing required arguments);
>    case 2:
>      opt1 = <default>;
>    case 3:
>      opt2 = <default>;
>    case 4:
>      opt3 = <default>;
>  }
> 
> [This might be a nice language extension, to let you specify the above idiom
> by:
> 
>  function (arg1, arg2, opt1 = <default>, opt2 = <default>, opt3 = <default>)
> 
> ]
> 
> On 2006-05-08, at 01:55 EDT, Adam Wolff wrote:
> 
> > you should declare and initialize your attribute values. I think that the
> > only case where you can't work around this is when you want to create a
> > method with an optional argument whose value may be null, zero or the
> > empty string.
> > 
> > A
> > 
> > On May 7, Benjamin Shine wrote:
> > 
> > > 
> > > On May 7, 2006, at 5:47 PM, P T Withington wrote:
> > > 
> > > > Looks good, but what is 'hasAttribute'?  Do you mean hasOwnProperty?
> > > > (Or
> > > > 'in', but we don't permit 'in').
> > > > 
> > > > The idiom we use for testing the existence of a property without getting
> > > > a
> > > > warning is this['prop'] -- the debugger does not warn on that.
> > > 
> > > I'd been doing that on Emerald, and then Adam Wolff said something
> > > disparaging
> > > about that idiom. Is hasOwnProperty the right way to do it? Mr Wolff, do
> > > you
> > > remember your preferred idiom for checking for this case without a
> > > debugger
> > > warning?
> > > 
> > > I picked up hasAttribute from dojo, and (upon research) it seems to be a
> > > DOM
> > > thing.
> > > 
> > > I will change to hasOwnProperty.
> > > 
> > > > 
> > > > But perhaps we should be working on ERROR's first, not WARNING's.  It is
> > > > not
> > > > an error in Javascript to reference a non-existent property, we only
> > > > have a
> > > > warning to help people debug.  Maybe I should make that warning
> > > > optional.
> > > 
> > > Stupid linux tricks, aka, ben just learned how to use cut:
> > > grep CLIENT_LOG work/logs/lps.log | grep ERROR | cut --delimiter=" " -f13
> > > |
> > > sort | uniq | wc -l
> > > tells me that my particular log (which was just one run of
> > > lztest/lztest-simple.lzx)
> > > has 85 unique errors
> > > 
> > > grep CLIENT_LOG work/logs/lps.log | grep WARNING | cut --delimiter=" "
> > > -f13 |
> > > sort | uniq | wc -l
> > > reveals 165 unique warnings
> > > 
> > > grep CLIENT_LOG work/logs/lps.log | grep WARNING | cut --delimiter=" "
> > > -f13 |
> > > cut -d: -f1 | sort -u
> > > reveals warnings from 18 files
> > > 
> > > and errors from only 13:
> > > grep CLIENT_LOG work/logs/lps.log | grep ERROR | cut --delimiter=" " -f13
> > > |
> > > cut -d: -f1 | sort -u | wc -l
> > > 
> > > ...which, in case you were wondering, is
> > > core/LzClass.as
> > > core/LzNode.as
> > > core/UserClass.as
> > > data/LzDataText.lzs
> > > glue/LaszloInitiator.as
> > > services/LzFocus.as
> > > services/LzFontManager.as
> > > services/LzInstantiator.as
> > > services/LzKeys.as
> > > services/LzModeManager.as
> > > views/LaszloCanvas.as
> > > views/LaszloView.as
> > > views/LzText6.as
> > > 
> > > 
> > > 
> > > > 
> > > > On 2006-05-07, at 17:56 EDT, Benjamin Shine wrote:
> > > > 
> > > > > 
> > > > > Tucker, I have risen to approximately 1% of your challenge. If these
> > > > > fixes
> > > > > are in the right vein, I'll keep going.
> > > > > 
> > > > > Change 42100 by [EMAIL PROTECTED] on 2006/05/07 14:49:36
> > > > > *pending*
> > > > > 
> > > > >       Summary: Eliminating a few warnings in LaszloCanvas.as
> > > > > instantiation.
> > > > >               New Features:
> > > > >               Bugs Fixed:
> > > > >               Technical Reviewer: ptw (pending)
> > > > >       QA Reviewer:  frisco (pending)
> > > > >       Doc Reviewer:  (pending)
> > > > >               Documentation:
> > > > >               Release Notes:
> > > > >               Details:
> > > > >          This change eliminates the following runtime errors and
> > > > > warnings,
> > > > > when I run
> > > > > http://localhost:8087/lps-legals/test/lztest/lztest-simple.lzx?debug=true
> > > > >          07 May 2006 14:21:26 (127.0.0.1 2) INFO
> > > > > responders.ResponderEVAL –
> > > > > CLIENT_LOG ERROR: views/LaszloCanvas.as:256: undefined object does not
> > > > > have a property ‘sendEvent’
> > > > >          07 May 2006 14:21:26 (127.0.0.1 1) INFO
> > > > > responders.ResponderEVAL –
> > > > > CLIENT_LOG WARNING: views/LaszloCanvas.as:256: reference to undefined
> > > > > property ‘onpercentcreated’
> > > > >          07 May 2006 14:21:26 (127.0.0.1 3) INFO
> > > > > responders.ResponderEVAL –
> > > > > CLIENT_LOG WARNING: views/LaszloCanvas.as:258: reference to undefined
> > > > > property ‘initdelay’
> > > > >          07 May 2006 14:21:26 (127.0.0.1 4) INFO
> > > > > responders.ResponderEVAL –
> > > > > CLIENT_LOG WARNING: views/LaszloCanvas.as:308: reference to undefined
> > > > > property ’LZlateinit’
> > > > >               Tests:
> > > > > 
> > > > > Affected files ...
> > > > > 
> > > > > ... //depot/lps-legals/WEB-INF/lps/lfc/core/LzNode.as#7 edit
> > > > > ... //depot/lps-legals/WEB-INF/lps/lfc/views/LaszloCanvas.as#5 edit
> > > > > ... //depot/lps-legals/lps/utils/lztestmanager.lzx#2 edit
> > > > > 
> > > > > 
> > > > > <changeset-42100.zip>
> > > > > 
> > > > > benjamin shine
> > > > > software engineer
> > > > > [EMAIL PROTECTED]
> > > > > 
> > > > > 
> > > > > 
> > > > 
> > > 
> > > benjamin shine
> > > software engineer
> > > [EMAIL PROTECTED]
> > > 
> > > 
> 
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to