1
0
Fork 0
Commit Graph

11 Commits (548c38503fba11c7a3d8c429eeb97ef0359303a7)

Author SHA1 Message Date
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 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 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 e0254f6441 Removed invalid @package tags
Not a valid tag in jsdoc
2011-12-06 20:19:31 -05:00
Mike Gerwitz 24e9dd2549 Oops. Dummy want to name things correctly? (#25) 2011-09-02 22:44:11 -04:00
Mike Gerwitz bc636637cc Refactored new and override method wrappers into separate prototypes
- Note that, since we're mid-refactor, this is a bit of a mess
2011-08-31 00:24:19 -04:00