Document these as you might imagine should work, that is next to the
declaration. I have a revision to the js2doc tool almost ready to go
that will handle these declarations; the code in branches/legals
doesn't yet do that.
/** blah blah */
function OldSkoolClass (arg1, arg2) { ... }
/** yadda yadda */
OldSkoolClass.prototype.foo = 10;
Max's singleton idiom won't yet work anywhere, but we can leave it
out for now since documenting LFC and Kernel sources is lower
priority than documenting the public interfaces:
/** yoodle */
var MaxStyleSingleton = {
/** boddle */
foo: 10,
}
On Feb 15, 2007, at 8:45 PM, Phillip George Apley wrote:
Jim (or anyone else who wants to take a crack at it),
This is a change in progress. I'm not actually submitting the code
as a patch yet. I'm still trying to figure out what to do to
satisfy both the compiler and the documentation syntax in certain
cases of field declarations in singleton classes. If you go through
the diffs you'll find a number of points where I ask 'How to
declare this field?' at the end of a comment. These are examples of
such. My valuable discussion with Tucker hasn't clarified it
enough. See more details below.
Change 20070215-papley-D by [EMAIL PROTECTED] on 2007-02-15
23:28:27 EST
in /Users/papley/src/svn/legals
Summay: Remove @field and @event tags. A number of these are still
not resolved and I need a little hint.
New Featues:
Bugs Fixed:
Technical Reviewe: (pending)
QA Reviewe: (pending)
Doc Reviewe: (pending)
Documentation:
Release Notes:
Details:
What to do with declarations of variables for singleton classes?
Tucker:
Max's 'js way' to declare a singleton:
Singleton = {
foo: 32 // instance var
doBar: function (...) { ... } // method
}
We need a js2 way for singletons. Max suggested:
static class Singleton {
var foo = 32;
function bar(...) { ... };
}
But Jim couldn't find a precedent for 'static class' meaning
singleton.
We're open to suggestions.
In Dylan, a singleton is created by over-riding make to always
return the same instance. We could do that:
class Singleton {
static var unique;
function make() {
return unique || unique = super();
}
}
[That's a sketch, don't try it at home.]
On 2007-02-13, at 19:51EST, Phillip George Apley wrote:
In a singleton class such as LzFontManager=new Object; a field such
as LzFontManager.fonts may be declared
within a method. In this case LzFontManager.__findMatchingFont uses
var fonts=... to declare the field.
Is there a way to declare such a variable outside a method (for
documentation purposes)?
Tests:
Files:
M WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
M WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
M WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
M WEB-INF/lps/lfc/kernel/swf/LzSprite.as
M WEB-INF/lps/lfc/services/LzKeys.as
M WEB-INF/lps/lfc/services/LzTrack.js
M WEB-INF/lps/lfc/services/LzTrack.as
M WEB-INF/lps/lfc/views/LzInputText.lzs
M WEB-INF/lps/lfc/views/LzText.lzs
M WEB-INF/lps/lfc/views/LzViewLinkage.lzs
M WEB-INF/lps/lfc/views/LaszloView.lzs
M WEB-INF/lps/lfc/views/LaszloCanvas.lzs
M WEB-INF/lps/lfc/helpers/LzFont.lzs
M WEB-INF/lps/lfc/helpers/LzState.lzs
M WEB-INF/lps/lfc/data/LzLazyReplicationManager.lzs
M WEB-INF/lps/lfc/data/LzDataText.lzs
M WEB-INF/lps/lfc/data/LzDataset.lzs
M WEB-INF/lps/lfc/data/LzDatasource.lzs
M WEB-INF/lps/server/bin/lzenv
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20070215-
papley-D.tar