From ab4874e2856849462f79ac61a7a1cf84b65c6b50 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 2 Jan 2017 23:38:09 -0500 Subject: [PATCH] Add constructor reference caveat to manual * doc/classes.texi: Add caveat for referencing the constructor when using ES6-style naming. --- doc/classes.texi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/classes.texi b/doc/classes.texi index 673b7d6..25f8db3 100644 --- a/doc/classes.texi +++ b/doc/classes.texi @@ -505,7 +505,14 @@ Implementation}), using a @code{__construct}@tie{}method: ease.js introduced the @code{constructor} method in version@tie{}0.2.7 to match the ES6 ``class'' implementation; it is an alias for @code{__construct}, - and they may be used interchangeably. + and they may be used interchangeably.@footnote{ + With one caveat: + when referencing the constructor method from another method + (dare I ask why you would do such a thing?), + you must use e.g.@tie{}@samp{this.__construct}; + using @samp{this.constructor} would not be very useful, + as this is always set (in JavaScript) to the function + that instantiated the object.} This method name may also be used prior to ES6. @float Figure, f:constructor-es6