Closed GoogleCodeExporter closed 8 years ago
Logical? Depends on whether initialise is a constructor or not. Is it? Not
being a
user of Prototype I don't actually know, which is why I posted for feedback on
this
topic a few weeks ago. Are you asserting that issue() is not a method of Animal?
Original comment by micmath
on 17 Feb 2008 at 12:27
erm, that should be "...asserting that initialise() is not a method of Animal?"
Original comment by micmath
on 17 Feb 2008 at 12:30
From http://www.prototypejs.org/api/class/create ...
"Class.create returns a function that, when called, will fire its own
initialize method."
Which is why I (possibly mistakenly) thought "initialize" was a method.
Original comment by micmath
on 17 Feb 2008 at 12:35
Given the Animal/Snake example, one would instantiate an Animal using
var myAnimal = new Animal( "aName", "aSound" );
One could probably also use
var myAnimal = new Animal();
myAnimal.initialize( "aName", "aSound" );
Which supports the current documentation generation.
But it's a shame that the (IMHO) more logical constructor named Animal with
arguments isn't documented as
at least a second constructor, which is one of the merits of Prototype.js.
Original comment by christop...@gmail.com
on 17 Feb 2008 at 12:37
I agree. I'll have a look at correcting that.
Original comment by micmath
on 17 Feb 2008 at 12:45
The latest revision of Version 2 allows for the documentation described here:
http://jsdoctoolkit.org/wiki/?page=lends
Unfortunately this breaks the prototype plugin (causes recursion), so that has
had to
be disabled.
Like so:
var Person = makeClass(
/**
@lends Person.prototype
*/
{
/** @constructor */
initialize: function(name) {
this.name = name;
},
say: function(message) {
return this.name + " says: " + message;
}
}
);
Original comment by micmath
on 24 Feb 2008 at 12:33
Michael, you meant "@constructs", not "@constructor", in the previous comment,
right?
As of 2.1.0, @constructs seems to work. @constructor does not.
Original comment by broofa
on 18 Feb 2009 at 1:15
Good spot, Robert, but actually on the 24th of February, 2008, I *did* mean
"@constructor". However, checking
the commit logs, I see that on the 25th of February (Revision: 521) the
following comment was made:
"Got @property to work, changed lent @constructor back to @constructs."
So, for anyone reading this now, the current solution is indeed @constructs,
which is the one that actually made
it into the release.
Original comment by micmath
on 19 Feb 2009 at 11:20
Original issue reported on code.google.com by
christop...@gmail.com
on 17 Feb 2008 at 12:19