It's fine with me, sounds like it's fine with Tucker, so go ahead.
Please test carefully before submitting.
jim
On Feb 8, 2007, at 3:07 PM, Phillip George Apley wrote:
So should I take this as a green light?
On Feb 8, 2007, at 4:14 PM, Jim Grandy wrote:
With regard to what doc tools changes this would require, they
would be relatively minor.
Currently we are special-casing "DeclareEvent(ref, 'eventname')"
in js2doc to output the proper documentation, so we'd switch to
special-casing "ref.eventname = LzEvent.nullEvent" to generate the
same markup.
On Feb 8, 2007, at 12:53 PM, Phillip George Apley wrote:
As an aside, I now have a smooth development environment that
allows me to perform testing,
compile the system, and make patches from either the PC or from
the Mac. I am using identical
.bashrc, setup-lps.sh, and svn-bash.sh files on PC and Mac !
I was reviewing my changes to DeclareEvent documentation and
Tucker proposed that I make
the following changes for efficiency and readability to the code
since I'm going to touch every
instance of DeclareEvent anyway.
Definitions for LzDeclaredEvent and DeclareEvent would be
eliminated.
I would define LzEvent.nullEvent;
static var nullEvent = {
sendEvent: function () {},
toString: function () { return "LzEvent.nullEvent"; }
};
There are three calling syntaxes for DeclareEvent right now:
1) DeclareEvent(prototype, eventName) - used within a class
definition.
2) DeclareEvent(ClassName.prototype, eventName) - may be used
inside or outside of a class definition.
3) DeclareEvent(ClassName, eventName) - used with a singleton
class.
For each of these syntaxes I would replace the code as follows:
1) var eventName = LzEvent.nullEvent;
2) Instances of syntax 2 would be substituted with syntax 1 and
placed inside the correct class definition.
3) ClassName.eventName = LzEvent.nullEvent;
One particular example from LzModeManager.lzs:
DeclareEvent(LzModeManager, 'onmode' );
LzModeManager.onmode = null; // This appears to be a mistake
because DeclareEvent is
// setting LzModeManager.onmode = LzDeclaredEvent and
it immediately being set to null after.
would become
LzModeManager.onmode = LzEvent.nullEvent;
Three questions immediately come to mind:
0) Are we missing any particul reason why LzDeclaredEvent is
superior to LzEvent.nullEvent?
1) Will this break anything?
2) How will we have to modify the documentation system to
accomodate the change.