1
0
Fork 0
Commit Graph

21 Commits (textend)

Author SHA1 Message Date
Mike Gerwitz d0ec7aca9b method.super references now ES3-compatible
This is a bugfix; the bug was introduced in v0.2.3.

In ECMAScript 5, reserved keywords can be used to reference the field of an
object in dot notation (e.g. method.super), but in ES3 this is prohibited;
in these cases, method['super'] must be used. To maintain ES3 compatiblity,
GNU ease.js will use the latter within its code.

Of course, if you are developing software that need not support ES3, then
you can use the dot notation yourself in your own code.

This does not sway my decision to use `super`---ES3 will soon (hopefully)
become extinct, and would be already were it not for the terrible influence
of Microsloth's outdated browsers.
2014-08-07 22:24:25 -04:00
Mike Gerwitz 887d5ef0a3 GNU ease.js and test cases now compile in strict mode
During its initial development, no environments (e.g. Node.js, Chromium,
Firefox) supported strict mode; this has since changed, and node has a
--use-strict option, which is used in the test runner to ensure conformance.
2014-05-04 22:17:28 -04:00
Mike Gerwitz 8ab183f4c8 Setting super method on override wrapper 2014-05-02 21:26:49 -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 744696b1a7
[copyright] Copyright update 2014-03-15 23:56:47 -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 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 97fbbd5bb9 [no-copyright] Modified headers to reduce GPL license notice width 2014-01-15 23:56:00 -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 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 28bf9e6421
Converted a number of test cases to new XUnit-style format 2012-05-03 21:47:43 -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 cdbcada4d2 Copyright year update 2011-12-23 00:09:11 -05:00
Mike Gerwitz d1b1d2691a Fixed initial warnings provided by Closure Compiler
Getting ready for release means that we need to rest assured that everything is
operating as it should. Tests do an excellent job at aiding in this, but they
cannot cover everything. For example, a simple missing comma in a variable
declaration list could have terrible, global consequences.
2011-12-10 11:18:41 -05:00
Mike Gerwitz e0254f6441 Removed invalid @package tags
Not a valid tag in jsdoc
2011-12-06 20:19:31 -05:00
Mike Gerwitz 1af7617a83 Moved instance binding test to MethodWrappersTest (#25)
- Ah; see how much nicer this is?
2011-09-02 23:07:42 -04:00
Mike Gerwitz 5937f7b0be Transferred method __super() invocation test to MethodWrappersTest (#25) 2011-09-02 22:55:10 -04:00
Mike Gerwitz 40d555ee3f Begin moving method wrapper tests into MethodWrappersTest (#25) 2011-09-02 22:47:35 -04:00