1
0
Fork 0
Commit Graph

56 Commits (3bd52122c54d3cbafbe2f7cc40b410a5dc081f9f)

Author SHA1 Message Date
Mike Gerwitz 3bd52122c5
Remove misplaced function annotations for defineSecureProp
Seemed like a good idea at the time, but now Closure Compiler complains.
2015-10-26 22:46:08 -04:00
Mike Gerwitz 579527d168
Class is not a needed dependency for Interface 2015-05-28 01:23:52 -04:00
Mike Gerwitz b9ba6388d2 Interface.isInstanceOf will account for interop compatibility
This is a bug fix.

If the provided object's constructor is an ease.js type, then the
conventional rules will apply (as mentioned in the test docblock and in the
manual); however, if it's just a vanilla ECMAScript object, then the interop
compatibility checks will be used instead.

The manual already states that this is the case; unfortunately, it
lies---this was apparently overlooked, and is a bug.
2014-08-06 23:07:44 -04:00
Mike Gerwitz 13b0bd2fb3 Visibility object is now encapsulated in symbol key
Note that this patch temporarily breaks encapsulation via
ClassBuilder.___$$privsym$$ to expose necessary internal details to Trait;
this will be resolved.
2014-07-09 00:14: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 aa0003d239 ClassBuilder.isInstanceOf now defers to type
This allows separation of concerns and makes the type system extensible. If
the type does not implement the necessary API, it falls back to using
instanceof.
2014-04-28 15:09:52 -04:00
Mike Gerwitz 4605476b4f Added isCompatible method to interfaces
There is a great amount of rationale in the test case added in this commit.
2014-04-28 15:09:52 -04:00
Mike Gerwitz 8391bc007d
No longer using __dirname in requires
I feel like I originally did this because older versions of node didn't like
relative paths (unless maybe the cwd wasn't in NODE_PATH). Regardless, it works
now, and this is cleaner.

Further, I noticed that __dirname didn't seem to be working properly with
browserify. While GNU ease.js does not make use of it (ease.js uses its own
scripts), other projects may.
2014-04-20 21:11:38 -04:00
Mike Gerwitz d23f34da4b Removed try/catch from Interface.extend
Permits more aggressive optimization.
2014-04-09 20:01:33 -04:00
Mike Gerwitz c76178516e Various argument handling optimizations
Permits more aggressive v8 optimization.
2014-04-09 20:01:33 -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 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 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 ae172a7a34
Corrected missing whitespace on interface instantiation error message 2013-04-13 12:34:52 -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 a10cf82a12 Abstract member declaration parameter name restrictions now apply to all abstract member declarations, not just interfaces 2011-12-21 20:12:05 -05:00
Mike Gerwitz 50904390da Interface members may now only contain arg names that are valid var names
- This should apply to all abstract definitions. This will be resolved in the next commit. I am tired.
2011-12-20 23:56:46 -05:00
Mike Gerwitz e24784529e Resolved majority of Closure Compiler warnings (VERBOSE)
- Ignored warnings from tests for now
- VERBOSE flag removed from Makefile for now until I can figure out how to
  resolve certain warnings
2011-12-13 21:19:14 -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 87dd1b8961 [#29] Re-added interface name to interface errors since abstract requirement change 2011-11-19 22:17:59 -05:00
Mike Gerwitz a33df4dcbe [#29] Refactored interface extend() test against non-interface into ExtendTest 2011-11-19 22:05:18 -05:00
Mike Gerwitz 4fe20762c8 'abstract' keyword no longer required for interface method declarations
- A warning is not yet being thrown for redundancy if the abstract keyword is
  explicitly specified
2011-11-19 19:37:59 -05:00
Mike Gerwitz 4e2af2333d [#25] Now injecting MemberBuilderValidator into MemberBuilder 2011-11-02 23:28:23 -04:00
Mike Gerwitz 02cd52cfb7 [#25] Began refactoring getter/setter building into a single method (util.propParse)
I'm unsure as to why I originally placed them in separate methods. propParse() will
always find a getter at the same time it finds a setter, and vice versa, should they
both have been defined on the object.
2011-10-29 08:08:02 -04:00
Mike Gerwitz 758162ad0f Began refactoring member_builder module into MemberBuilder prototype (#25) 2011-08-14 18:47:48 -04:00
Mike Gerwitz 87e7872f61 Using __dirname for modules rather than relative path 2011-03-27 02:02:04 -04:00
Mike Gerwitz 4d2852627e All interface members must now be public 2011-03-19 00:58:42 -04:00
Mike Gerwitz b321610cc7 Interface name included in instantiation error, if available 2011-03-05 21:46:44 -05:00
Mike Gerwitz 6f7dabe35e Interface name is included in declaration errors, if available 2011-03-05 17:27:02 -05:00
Mike Gerwitz da8be9affa Interface definition errors now contain class name when available 2011-03-05 12:57:21 -05:00
Mike Gerwitz 0ccdf07145 Implemented strict argument check for interface creation 2011-03-04 23:43:30 -05:00
Mike Gerwitz 649356ef23 Refactored interface module invocation into separate functions for named and anonymous 2011-03-04 23:35:28 -05:00
Mike Gerwitz 7bb87e370f No need to recheck the type each time 2011-03-04 00:24:42 -05:00
Mike Gerwitz 009c4a93e9 Interfaces now have sane/useful values when converted to strings 2011-03-04 00:19:02 -05:00
Mike Gerwitz 85e687e29c Added Interface.isInterface() 2011-03-03 23:59:37 -05:00
Mike Gerwitz 3f915d3644 The interface module may now be invoked, providing a more natural looking means of declaring interfaces 2011-03-03 19:08:24 -05:00
Mike Gerwitz e3561a492f Modified interface property message to be a bit more helpful in a likely common scenerio 2011-03-01 09:17:24 -05:00
Mike Gerwitz 188ad2f4eb Getters/setters are not supported within interface definitions 2011-01-24 23:56:54 -05:00
Mike Gerwitz 70f5d09c34 Interface now uses propParse and member builders 2011-01-24 23:35:45 -05:00
Mike Gerwitz 80b0732be1 Interfaces cannot be instantiated 2010-12-29 22:40:23 -05:00
Mike Gerwitz 38a6a4ee6a Added missing semi-colons that would otherwise be inserted via semicolon insertion 2010-12-28 22:10:12 -05:00
Mike Gerwitz 789f2390af All functions are now camelCase 2010-12-28 22:08:30 -05:00
Mike Gerwitz 004ccfa05b Interfaces cannot inherit from Classes 2010-12-28 21:56:55 -05:00
Mike Gerwitz 928a0ea297 Removed Interface.abstractMethod() in favor of 'abstract' keyword 2010-12-28 20:13:50 -05:00