1
0
Fork 0
Commit Graph

541 Commits (30f769b919f7a2725db5fd9476ec12a4187eb2f5)

Author SHA1 Message Date
Mike Gerwitz 85cc251adf Added baseline tests for prototype method and function call invocation 2014-04-09 20:00:54 -04:00
Mike Gerwitz 82a02c0081 [copyright] Copyright assignment to the FSF
Thanks to Donald Robertson III for his help and guidance during this
process.
2014-04-09 19:05:07 -04:00
Mike Gerwitz c835641dcb Private methods are no longer wrapped
This is an exciting performance optimization that seems to have eluded me
for a surprisingly long time, given that the realization was quite random.
ease.js accomplishes much of its work through a method wrapper---each and
every method definition (well, until now) was wrapped in a closure that
performed a number of steps, depending on the type of wrapper involved:

  1. All wrappers perform a context lookup, binding to the instance's private
     member object of the class that defined that particular method. (See
     "Implementation Details" in the manual for more information.)
  2. This context is restored upon returning from the call: if a method
     returns `this', it is instead converted back to the context in which
     the method was invoked, which prevents the private member object from
     leaking out of a public interface.
  3. In the event of an override, this.__super is set up (and torn down).

There are other details (e.g. the method wrapper used for method proxies),
but for the sake of this particular commit, those are the only ones that
really matter. There are a couple of important details to notice:

  - Private members are only ever accessible from within the context of the
    private member object, which is always the context when executing a
    method.
  - Private methods cannot be overridden, as they cannot be inherited.

Consequently:

  1. We do not need to perform a context lookup: we are already in the proper
     context.
  2. We do not need to restore the context, as we never needed to change it
     to begin with.
  3. this.__super is never applicable.

Method wrappers are therefore never necessary for private methods; they have
therefore been removed.

This has some interesting performance implications. While in most cases the
overhead of method wrapping is not a bottleneck, it can have a strong impact
in the event of frequent method calls or heavily recursive algorithms. There
was one particular problem that ease.js suffered from, which is mentioned in
the manual: recursive calls to methods in ease.js were not recommended
because it

  (a) made two function calls for each method call, effectively halving the
      remaining call stack size, and
  (b) tail call optimization could not be performed, because recursion
      invoked the wrapper, *not* the function that was wrapped.

By removing the method wrapper on private methods, we solve both of these
problems; now, heavily recursive algorithms need only use private methods
(which could always be exposed through a protected or public API) when
recursing to entirely avoid any performance penalty by using ease.js.

Running the test cases on my system (your results may vary) before and after
the patch, we have:

  BEFORE:
  0.170s (x1000 = 0.0001700000s each): Declare 1000 anonymous classes with
    private members
  0.021s (x500000 = 0.0000000420s each): Invoke private methods internally

  AFTER:
  0.151s (x1000 = 0.0001510000s each): Declare 1000 anonymous classes with
    private members
  0.004s (x500000 = 0.0000000080s each): Invoke private methods internally

This is all the more motivation to use private members, which enforces
encapsulation; keep in mind that, because use of private members is the
ideal in well-encapsulated and well-factored code, ease.js has been designed
to perform best under those circumstances.
2014-03-20 23:43:24 -04:00
Mike Gerwitz 744696b1a7
[copyright] Copyright update 2014-03-15 23:56:47 -04:00
Mike Gerwitz cc43f4b339 Prohibiting trait getters/setters 2014-03-15 21:16:27 -04:00
Mike Gerwitz eab4dbfe4d Throwing exception on trait static member
These will be supported in future versions; this is not something that I
want to rush, nor is it something I want to hold up the first GNU release;
it is likely to be a much lesser-used feature.
2014-03-15 21:16:27 -04:00
Mike Gerwitz 3d47443046 Refactored ClassBuilder.buildMembers (dynamic prop parse context)
The parser methods are now split into their own functions. This has a number
of benefits: The most immediate is the commit that will follow. The second
benefit is that the function is no longer a closure---all context
information is passed into it, and so it can be optimized by the JavaScript
engine accordingly.
2014-03-15 21:16:27 -04:00
Mike Gerwitz 7d27bc7969 Exposing Trait module
Oh boy oh boy oh boy!
2014-03-15 21:16:27 -04:00
Mike Gerwitz 255a60e425 Implemented and abstract with mixins properly handled
Classes will now properly be recognized as concrete or abstract when mixing
in any number of traits, optionally in conjunction with interfaces.
2014-03-15 21:16:27 -04:00
Mike Gerwitz 696b8d05a6 Class definition mixin now requires explicit extend
See the rather verbose docblocks in this diff for more information.
Additional rationale will be contained in the commits that follow.
2014-03-15 21:16:27 -04:00
Mike Gerwitz a7e381a31e Mixing method invocation performance tests
As expected, mixin method invocation is dramatically slower than
conventional class method definitions. However, it is a bit slower than I
had anticipated; future releases will definately need to take a look at
improving performance, which should happen anyway, since the trait
implementation takes the easy way out in a number of instances.

Let's get an initial release first.
2014-03-15 21:16:27 -04:00
Mike Gerwitz 433dd4fb7a Trait definition and mixin performance test cases
Does not yet include many more detailed tests, such as method invocation
times, which will be of particular interest. While definitions are indeed
interesting, they often occur when a program is loading---when the user is
expecting to wait. Not so for method invocations.
2014-03-15 21:16:27 -04:00
Mike Gerwitz 55e993a74d Non-private properties now expressly prohibited in trait dfns
:O What?! See Trait/PropertyTest for more information on why this is the
case, at least for now.
2014-03-15 21:16:27 -04:00
Mike Gerwitz 3005cda543 Support for stacked mixins
The concept of stacked traits already existed in previous commits, but until
now, mixins could not be stacked without some ugly errors. This also allows
mixins to be stacked atop of themselves, duplicating their effect. This
would naturally have limited use, but it's there.

This differs slightly from Scala. For example, consider this ease.js mixin:

  C.use( T ).use( T )()

This is perfectly valid---it has the effect of stacking T twice. In reality,
ease.js is doing this:

  - C' = C.use( T );
  - new C'.use( T );

That is, it each call to `use' creates another class with T mixed in.

Scala, on the other hand, complains in this situation:

  new C with T with T

will produce an error stating that "trait T is inherited twice". You can
work around this, however, by doing this:

  class Ca extends T
  new Ca with T

In fact, this is precisely what ease.js is doing, as mentioned above; the
"use.use" syntax is merely shorthand for this:

  new C.use( T ).extend( {} ).use( T )

Just keep that in mind.
2014-03-15 21:16:27 -04:00
Mike Gerwitz 88713987e2 Mixin use method calls can now be chained
Syntatic sugar; could have previously extended explicitly and then mixed in.
2014-03-15 21:16:27 -04:00
Mike Gerwitz 8480d8f92c Added support for abstract overrides 2014-03-15 21:16:27 -04:00
Mike Gerwitz 14bd552361 Trait can now implement interfaces
Note the incomplete test case: the next commit will introduce the ability
for mixins to override methods that may have already been defined.
2014-03-15 21:16:27 -04:00
Mike Gerwitz c8023cb382 Trait method return value implementation correction and testing 2014-03-15 21:16:27 -04:00
Mike Gerwitz 6473cf35ae Began Scala-influenced linearization implementation
More information on this implementation and the rationale behind it will
appear in the manual. See future commits.

(Note the TODOs; return values aren't quite right here, but that will be
handled in the next commit.)
2014-03-15 21:16:27 -04:00
Mike Gerwitz 8d81373ef8 Began named trait implementation
Does not yet support staging object like classes
2014-03-15 21:16:27 -04:00
Mike Gerwitz 26bd6b88dd Named classes now support mixins 2014-03-15 21:16:27 -04:00
Mike Gerwitz 455d3a5815 Added immediate partial class invocation support after mixin 2014-03-15 21:16:27 -04:00
Mike Gerwitz 897a4afab4 Added support for mixing in traits using use method on a base class 2014-03-15 21:16:27 -04:00
Mike Gerwitz 999c10c3bf Subtype mixin support 2014-03-15 21:16:27 -04:00
Mike Gerwitz 451ec48a5c Objects are now considered types of class's mixed in traits
This is a consequence of ease.js' careful trait implementation that ensures
that any mixed in trait retains its API in the same manner that interfaces
and supertypes do.
2014-03-15 21:16:27 -04:00
Mike Gerwitz ee46fc2182 Began testing class subtyping with mixins 2014-03-15 21:16:27 -04:00
Mike Gerwitz 513bd1a733 Added test case for visibility escalation internally
For completeness, since this is how I originally observed the issue fixed in
the previous commit.
2014-03-15 21:16:26 -04:00
Mike Gerwitz bcada87240 [bug fix] Corrected bug with implicit visibility escalation
See test case comments for details. This wasted way too much of my time.
2014-03-15 21:16:26 -04:00
Mike Gerwitz 66cab74cc1 Initial trait virtual member proxy implementation
This has some flaws that should be addressed, but those will be detailed in
later commits; this works for now.
2014-03-15 21:16:26 -04:00
Mike Gerwitz b7a314753a Began implementing virtual trait methods
These require special treatment with proxying.
2014-03-15 21:16:26 -04:00
Mike Gerwitz 40e287bfc3 Warning no longer issued when overriding weak method appearing later in dfn obj 2014-03-15 21:16:26 -04:00
Mike Gerwitz 1b323ed80b Validation warnings now stored in state object
This will allow for additional processing before actually triggering the
warnings. For the sake of this commit, though, we just keep with existing
functionality.
2014-03-15 21:16:26 -04:00
Mike Gerwitz dac4b9b3a1 The `weak' keyword can now apply to overrides
Well, technically anything, but we're leaving that behavior as undefined for
now (the documentation will say the same thing).
2014-03-07 00:47:43 -05:00
Mike Gerwitz b04a8473b8 Implemented abstract traits
This is just an initial implementation, so there may be some quirks; there
are more tests to come.
2014-03-07 00:47:43 -05:00
Mike Gerwitz 987a2b88ec Classes can now access trait protected members
Slight oversight in the original commit.
2014-03-07 00:47:43 -05:00
Mike Gerwitz c10fe5e248 Proxy methods may now override abstract methods
The method for doing so is a kluge; see the test case for more info.
2014-03-07 00:47:43 -05:00
Mike Gerwitz 548c38503f Added support for weak abstract methods
This adds the `weak' keyword and permits abstract method definitions to
appear in the same definition object as the concrete implementation. This
should never be used with hand-written code---it is intended for code
generators (e.g. traits) that do not know if a concrete implementation will
be provided, and would waste cycles duplicating the property parsing that
ease.js will already be doing. It also allows for more concise code
generator code.
2014-03-07 00:47:43 -05:00
Mike Gerwitz 18ac37c871 Added support for `weak' keyword
Note that, even though it's permitted, the validator still needs to be
modified to permit useful cases. In particular, I need weak abstract and
strong concrete methods for use in traits.
2014-03-07 00:47:43 -05:00
Mike Gerwitz 93eda3c14b Added tests proving traits' scopes are disjoint from classes' and each others'
This was the original motiviation behind, and is a beautiful consequence of,
the composition-based trait implementation (see
<https://savannah.gnu.org/task/index.php#comment3>).
2014-03-07 00:47:43 -05:00
Mike Gerwitz e44ac3190b Protected trait methods are now mixed in 2014-03-07 00:47:43 -05:00
Mike Gerwitz 3724b1bc0d Re-implemented mixin error for member name conflicts 2014-03-07 00:47:43 -05:00
Mike Gerwitz 71358eab59 Began implementing composition-based traits
As described in <https://savannah.gnu.org/task/index.php#comment3>.

The benefit of this approach over definition object merging is primarily
simplicitly---we're re-using much of the existing system. We may provide
more tight integration eventually for performance reasons (this is a
proof-of-concept), but this is an interesting start.

This also allows us to study and reason about traits by building off of
existing knowledge of composition; the documentation will make mention of
this to explain design considerations and issues of tight coupling
introduced by mixing in of traits.
2014-03-07 00:47:42 -05:00
Mike Gerwitz dfc83032d7 Basic, incomplete, but workable traits
Note the incomplete tests. These are very important, but the current state
at least demonstrates conceptually how this will work (and is even useful in
its current state, albeit dangerous and far from ready for production).
2014-03-07 00:47:42 -05:00
Mike Gerwitz 62035a0b4c Beginning of Trait and Class.use
This is a rough concept showing how traits will be used at definition time
by classes (note that this does not yet address how they will be ``mixed
in'' at the time of instantiation).
2014-03-07 00:47:42 -05:00
Mike Gerwitz 44a45d1f44
rmtrail now handles single-line comments following trailing comma 2014-03-07 00:47:28 -05:00
Mike Gerwitz 29576cfee4
Corrected GetPropertyDescriptorTest traversal test 2014-03-07 00:45:30 -05:00
Mike Gerwitz 7f8d265877
Corrected override of super-super methods
More generally, this was a problem with not recursing on *all* of the
visibility objects of the supertype's supertype; the public visibility
object was implicitly recursed upon through JavaScript's natural prototype
chain, so this only manifested itself with protected members.
2014-02-24 23:03:04 -05:00
Mike Gerwitz 9a3a71bc33
Added test/runner to run individual test cases
The check/test/test-suite make targets can still be used, but this at least
allows running specific test cases from the command line, which is extremely
useful during development.
2014-02-14 00:41:49 -05:00
Mike Gerwitz 89f00e0cdd [copyright] Copyright update 2014-01-20 22:55:29 -05:00
Mike Gerwitz 8789be1c4a Test suite will now output thrown data if stack not available 2014-01-20 22:23:22 -05:00
Mike Gerwitz ed0a784d9a Moved final test test-combine-pre-es5 into suite as CombinedPreES5Test
Holy hell that was a long and tedious process. It's nice to finally have
everything in the new test suite.

Still plenty of work to be done with refactoring (both the library and test
cases), though.
2014-01-20 22:14:42 -05:00
Mike Gerwitz 9fe55c54d6 Moved test-combine into suite as CombineTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 476f86723e Test runner will not output duplicate newline before results when total % 60 2014-01-20 22:14:42 -05:00
Mike Gerwitz 2f55d60993 Moved test-index into suite as IndexTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz a3baa99f1c Moved test-interface-name into suite as Interface/TestName 2014-01-20 22:14:42 -05:00
Mike Gerwitz 7b637db815 Moved test-util-prop-parse-keywords into suite as Util/PropParseKeywordsTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 6c0253c23c Moved test-util-prop-prase into suite as Util/PropParseTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 202ce8477f Moved test-util-get-property-descriptor into suite as Util/GetPropertyDescriptorTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 3301f22e69 Moved test-util-abstract into suite as Util/AbstractTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 086ede6849 Moved test-util-define-secure-prop into suite as Util/DefineSecurePropTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz c75241ca2b Moved test-util-copy into suite as Util/CopyTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 7b591ba426 Moved test-util-clone into suite as Util/CloneTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz ba1c3044de Moved test-prop_parser-parse-keywords into suite as PropParserKeywordsTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 72da8f2dee Moved test-warn-* tests into suite 2014-01-20 22:14:42 -05:00
Mike Gerwitz aad013bd87 Moved test-class-abstract into suite as Class/AbstractTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 37d66b375d Moved test-class-gettersetter into suite as Class/GetterSetterTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 0b1bf31b8d Moved test-class-name into test suite as Class/NameTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz ee886f2d37 Moved test-class-constructor into suite as Class/ConstructorTest
Also removed assertions that are performed elsewhere.

We broke onto the fifth line in the suite ;)
2014-01-20 22:14:42 -05:00
Mike Gerwitz d0bc34a7f3 Moved test-class-parent into test suite as Class/ParentTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 2b5bcaf02d Moved test-class-extend into suite as Class/{Extend,InstanceSafety}Test
More refactoring to come for ExtendTest at some point
2014-01-20 22:14:42 -05:00
Mike Gerwitz ae367964a3 Moved test-class into suite as Class/GeneralTest
This guy had some old tests indeed; it wasn't even in the second incarnation
of the test formats! Flasback to the beginning of ease.js.
2014-01-20 22:14:42 -05:00
Mike Gerwitz f11b3b1f38 Moved test-class_builder-final into test suite as ClassBuilder/FinalTest 2014-01-20 22:14:42 -05:00
Mike Gerwitz 2aca9726c3 Moved test-class_builder-member-restrictions into test suite as ClassBuilder/MemberRestrictionTest 2014-01-20 22:14:41 -05:00
Mike Gerwitz 782e2c96cb Moved test-class_builder-visibility into suite as ClassBuilder/VisibilityTest 2014-01-20 22:14:41 -05:00
Mike Gerwitz b5e72b2934 Moved test-class_builder-const into suite as ClassBuilder/ConstTest 2014-01-20 22:14:41 -05:00
Mike Gerwitz d8243707ad Moved test-class-visibility into suite as Class/VisibilityTest 2014-01-20 22:14:41 -05:00
Mike Gerwitz 85a201558d Moved ClassImplementTest into Class subdirectory in preparation for other test cases 2014-01-20 22:14:41 -05:00
Mike Gerwitz b281ccba8f Moved test-class_builder-static into suite as ClassBuilder/StaticTest 2014-01-20 22:14:41 -05:00
Mike Gerwitz fb501a45e8 Moved test-class-implement into suite as ClassImplementTest 2014-01-20 22:14:41 -05:00
Mike Gerwitz 97fbbd5bb9 [no-copyright] Modified headers to reduce GPL license notice width 2014-01-15 23:56:00 -05:00
Mike Gerwitz e03454b2b9 Corrected new Closure Compiler warnings 2014-01-06 22:05:05 -05:00
Mike Gerwitz 897b68e3e0 Tests now work properly with auto* and no longer require minified files 2013-12-23 00:27:20 -05:00
Mike Gerwitz 8b83add95f ease.js is now GNU ease.js.
On Sun, Dec 22, 2013 at 03:31:08AM -0500, Richard Stallman wrote:
> I hereby dub ease.js a GNU package, and you its maintainer.
>
> Please don't forget to mention prominently in the README file and
> other suitable documentation places that it is a GNU program.
2013-12-23 00:27:18 -05:00
Mike Gerwitz 26dffce00a [copyright] Copyright update after adding --follow to copyright script 2013-12-22 22:50:29 -05:00
Mike Gerwitz 13ca9cd852
[copyright] Copyright update after relicensing 2013-12-20 01:11:39 -05:00
Mike Gerwitz 9050c4e4ac
Relicensed under the GPLv3+
This project was originally LGPLv+-licensed to encourage its use in a community
that is largely copyleft-phobic. After further reflection, that was a mistake,
as adoption is not the important factor here---software freedom is.

When submitting ease.js to the GNU project, it was asked if I would be willing
to relicense it under the GPLv3+; I agreed happily, because there is no reason
why we should provide proprietary software any sort of edge. Indeed, proprietary
JavaScript is a huge problem since it is automatically downloaded on the user's
PC generally without them even knowing, and is a current focus for the FSF. As
such, to remain firm in our stance against proprietary JavaScript, relicensing
made the most sense for GNU.

This is likely to upset current users of ease.js. I am not sure of their
number---I have only seen download counts periodically on npmjs.org---but I know
there are at least a small number. These users are free to continue using the
previous LGPL'd releases, but with the understanding that there will be no
further maintenance (not even bug fixes). If possible, users should use the
GPL-licensed versions and release their software as free software.

Here comes GNU ease.js.
2013-12-20 01:10:05 -05:00
Mike Gerwitz 2a76be2461
[copyright] Copyright update 2013-12-20 00:50:54 -05:00
Mike Gerwitz daae0c6843
Corrected bug whereby multiple override calls would clear __super too early
Before this change, __super was set to undefined. However, consider that we have two
method overrides---foo and bar---and the code for bar is:

  this.foo();
  this.__super();

foo() would set __super to undefined and so bar cannot invoke its super method
unless it stores a reference to __super before invoking foo(). This patch fixes
this issue.
2013-04-20 21:55:40 -04:00
Mike Gerwitz b4fe08292f
'this' now properly binds to the private member object of the instance for getters/setters
Getters/setters did not get much attention during the initial development of
ease.js, simply because there was such a strong focus on pre-ES5
compatibility---ease.js was created for a project that strongly required it.
Given that, getters/setters were not used, since those are ES5 features. As
such, I find that two things have happened:

  1. There was little incentive to provide a proper implementation; even though
     I noticed the issues during the initial development, they were left
     unresolved and were then forgotten about as the project lay dormant for a
     while.
  2. The project was dormant because it was working as intended (sure, there
     are still things on the TODO-list feature-wise). Since getters/setters were
     unused in the project for which ease.js was created, the bug was never
     found and so never addressed.

That said, I now am using getters/setters in a project with ease.js and noticed
a very odd bug that could not be explained by that project's implementation.
Sure enough, it was an ease.js issue and this commit resolves it.

Now, there is more to be said about this commit. Mainly, it should be noted that
MemberBuilder.buildGetterSetter, when compared with its method counterpart
(buildMethod) is incomplete---it does not properly address overrides, the
abstract keyword, proxies or the possibility of method hiding. This is certainly
something that I will get to, but I want to get this fix out as soon as I can.
Since overriding ES5 getters/setters (rather than explicit methods) is more
likely to be a rarity, and since a partial fix is better than no fix, this will
likely be tagged immediately and a further fix will follow in the (hopefully
near) future.

(This is an interesting example of how glaring bugs manage to slip through the
cracks, even when the developer is initially aware of them.)
2013-01-19 22:38:35 -05:00
Mike Gerwitz 8b74ed9f1b
Corrected a bug whereby getters were being inadvertently invoked by util.propParse()
Nasty; hopefully this was found before it did any harm to anyone else! This bug was discovered accidentally while I was debugging a separate issue.
2013-01-19 22:38:31 -05:00
Mike Gerwitz 6c7ccdcb3b
Added GNU GPL v3+ license header and copyright notice to all scripts and Makefiles
Note: ease.js is licensed under the LGPL. Many of its external scripts are under the GPL.
2012-05-11 19:11:12 -04:00
Mike Gerwitz 28bf9e6421
Converted a number of test cases to new XUnit-style format 2012-05-03 21:47:43 -04:00
Mike Gerwitz 0d306b63c8
Moved setup method for XUnit style testing into tryTest() function to properly handle exceptions
- Most importantly in this case, skips
2012-05-03 21:47:36 -04:00
Mike Gerwitz e67c14e8c3
Added support for static proxy methods
When the static keyword is provided, the proxy will use the static accessor
method to look up the requested member.
2012-05-03 14:13:47 -04:00
Mike Gerwitz d84b86b21b
Added `proxy' keyword support
The concept of proxy methods will become an important, core concept in ease.js
that will provide strong benefits for creating decorators and proxies, removing
boilerplate code and providing useful metadata to the system. Consider the
following example:

  Class( 'Foo',
  {
      // ...

      'public performOperation': function( bar )
      {
          this._doSomethingWith( bar );
          return this;
      },
  } );

  Class( 'FooDecorator',
  {
      'private _foo': null,

      // ...

      'public performOperation': function( bar )
      {
          return this._foo.performOperation( bar );
      },
  } );

In the above example, `FooDecorator` is a decorator for `Foo`. Assume that the
`getValueOf()` method is undecorated and simply needs to be proxied to its
component --- an instance of `Foo`. (It is not uncommon that a decorator, proxy,
or related class will alter certain functionality while leaving much of it
unchanged.) In order to do so, we can use this generic, boilerplate code

  return this.obj.func.apply( this.obj, arguments );

which would need to be repeated again and again for *each method that needs to
be proxied*. We also have another problem --- `Foo.getValueOf()` returns
*itself*, which `FooDecorator` *also* returns.  This breaks encapsulation, so we
instead need to return ourself:

  'public performOperation': function( bar )
  {
      this._foo.performOperation( bar );
      return this;
  },

Our boilerplate code then becomes:

  var ret = this.obj.func.apply( this.obj, arguments );
  return ( ret === this.obj )
      ? this
      : ret;

Alternatively, we could use the `proxy' keyword:

  Class( 'FooDecorator2',
  {
      'private _foo': null,

      // ...

      'public proxy performOperation': '_foo',
  } );

`FooDecorator2.getValueOf()` and `FooDecorator.getValueOf()` both perform the
exact same task --- proxy the entire call to another object and return its
result, unless the result is the component, in which case the decorator itself
is returned.

Proxies, as of this commit, accomplish the following:
  - All arguments are forwarded to the destination
  - The return value is forwarded to the caller
    - If the destination returns a reference to itself, it will be replaced with
      a reference to the caller's context (`this`).
  - If the call is expected to fail, either because the destination is not an
    object or because the requested method is not a function, a useful error
    will be immediately thrown (rather than the potentially cryptic one that
    would otherwise result, requiring analysis of the stack trace).

N.B. As of this commit, static proxies do not yet function properly.
2012-05-03 09:49:22 -04:00
Mike Gerwitz 1b17900294 Resolved version test error caused by verset commit 2012-04-06 00:21:05 -04:00
Mike Gerwitz fa9dbcbf2e [Fix #37] constructor property now properly set on instances 2012-01-19 23:21:04 -05:00
Mike Gerwitz 9dbd0d1fb3 Added constructor property to reserved members list 2012-01-17 23:36:01 -05:00
Mike Gerwitz 958521f673 Created version module to provide additional version information 2011-12-23 18:31:11 -05:00
Mike Gerwitz cdbcada4d2 Copyright year update 2011-12-23 00:09:11 -05:00