1
0
Fork 0
Commit Graph

1185 Commits (4b14813340fb602c185194cb1963642c8d4ed99d)

Author SHA1 Message Date
Mike Gerwitz 47e6bacd8b
Re-add README
Now that the README issue with npm is resolved, I'm re-adding this; README
is standard, and really all GNU projects should have it.
2015-12-22 10:19:30 -05:00
Mike Gerwitz 3db234f9d4
Resolve potential reproducible build issues
GNU ease.js is a pretty trivial case with respect to reproducibility---not
much goes on during the build aside from concatenation and minification.
Non-determinism is essentially confined to filesystem operations, which can
be rectified by sorting using a static locale's collation sequence (which is
done here).

This does not resolve any concerns with autoconf-installed scripts (those in
tools/), or the distribution tarball file metadata.
2015-12-21 22:34:28 -05:00
Mike Gerwitz 81bb349238
Move README.md license below title
This resolves a long-standing NPM issue whereby it was not rendering the
README (instead saying that it does not exist)
2015-12-19 01:12:20 -05:00
Mike Gerwitz febb4e3e16
Ignore known bad commits in signchk
The two commits ignored here were a mistake.  Regrettable.

This commit that introduces these ignores is signed, so these ignores can be
trusted.
2015-10-26 22:52:44 -04:00
Mike Gerwitz c0a1a9bdcc
[copyright] Copyright update for recent changes 2015 2015-10-26 22:49:28 -04:00
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 54412f24b6 Do not attempt copy of phony `check` during dist-hook
Whoops.
2015-10-26 22:39:52 -04:00
Mike Gerwitz 8707e537ab
Fix protected mixin override for ES3 fallbacks
It's fun when you're about to make a release and find that ES3 fallback
tests are failing.  That's also what happens when you decide not to run
the combined tests until the last minute, because they usually don't fail.
2015-10-26 22:34:48 -04:00
Mike Gerwitz 903a1a135c
Prevent mixin failure on null/undefined supertype properties 2015-10-26 22:17:28 -04:00
Mike Gerwitz 172e2e2afe
Force check target on dist
This is to ensure that final tests are run after combined files are generated.
2015-10-25 23:22:42 -04:00
Mike Gerwitz ab8cdfa173
Remove deleted README files from dist
Replace with their equivalents.
2015-10-25 22:54:45 -04:00
Mike Gerwitz bd3aa85645
Support for trait class supertype method overrides
See the specific commit for more information as part of the commit message.
2015-10-25 22:44:50 -04:00
Mike Gerwitz 47d51fd5da
Provide useful error on attempt to mix in non-trait
Before this change, mixin attempts would fail at the time of mixin when
easejs attempts to invoke the `__mixin` method on the object.  This is both
cryptic and void of any useful information on the stack.
2015-10-25 22:15:34 -04:00
Mike Gerwitz d9b86c1544
Support for trait class supertype overrides
Traits can now override methods of their class supertypes.  Previously, in
order to override a method of some class `C` by mixing in some trait `T`,
both had to implement a common interface.  This had two notable downsides:

  1. A trait that was only compatible with details of `C` could only work
     with `C#M` if it implemented an interface `I` that declared `I#M`.
     This required the author of `C` to create interfaces where they would
     otherwise not be necessary.

  2. As a corollary of #1---since methods of interfaces must be public, it
     was not possible for `T` to override any protected method of `C`; this
     meant that `C` would have to declare such methods public, which may
     break encapsulation or expose unnecessary concerns to the outside
     world.

Until documentation is available---hopefully in the near future---the test
cases provide detailed documentation of the behavior.  Stackable traits work
as you would expect:

```javascript
var C = Class(
{
    'virtual foo': function()
    {
        return 'C';
    },
} );

var T1 = Trait.extend( C,
{
    'virtual abstract override foo': function()
    {
        return 'T1' + this.__super();
    },
} );

var T2 = Trait.extend( C,
{
    'virtual abstract override foo': function()
    {
        return 'T2' + this.__super();
    },
} );

C.use( T1 )
    .use( T1 )
    .use( T2 )
    .use( T2 )
    .foo();
// result: "T2T2T1T1C"
```

If the `override` keyword is used without `abstract`, then the super method
is statically bound to the supertype, rather than being resolved at runtime:

```javascript
var C = Class(
{
    'virtual foo': function()
    {
        return 'C';
    },
} );

var T1 = Trait.extend( C,
{
    'virtual abstract override foo': function()
    {
        return 'T1' + this.__super();
    },
} );

var T2 = Trait.extend( C,
{
    // static override
    'virtual override foo': function()
    {
        return 'T2' + this.__super();
    },
} );

C.use( T1 )
    .use( T1 )
    .use( T2 )
    .use( T2 )
    .foo();
// result: "T2C"
```

This latter form should be discouraged in most circumstances (as it prevents
stackable traits), but the behavior is consistent with the rest of the
system.

Happy hacking.
2015-10-24 23:53:23 -04:00
Mike Gerwitz 02e8b796ee
Documentation compatibility with Texinfo 5.2
I upgraded Texinfo recently and found that ease.js' documentation would no
longer compile.  The errors make sense, but it's an unfortunate regression.
The previous version that I was using was 4.13, which is quite old.
2015-10-17 00:11:28 -04:00
Mike Gerwitz 50500ed290
ES6-style constructor documentation
Shame on me for not including this in the previous merge!
2015-09-16 00:39:26 -04:00
Mike Gerwitz 0e26f9fd0f Strip `public` keyword from __construct in docs
It must be public, so by convention, I don't include it anymore.  But this
is personal preference.
2015-09-16 00:38:04 -04:00
Mike Gerwitz 90aa74d0cb ES6-style constructor added to documentation 2015-09-16 00:37:24 -04:00
Mike Gerwitz cbf98cccf1
ES6-style constructors
Included with this change is a simple "wrapper" implementation:

```
// equivalent
easejs( Foo );
Class.extend( Foo, {} );
```
2015-09-16 00:15:50 -04:00
Mike Gerwitz d3f1f0dee2 Add test to ensure multiple constructors cannot be defined 2015-09-16 00:02:02 -04:00
Mike Gerwitz ba2605f836 Alias `constructor` member to `__construct`
This allows ease.js classes to mimic the structure of ES6 classes, which use
`constructor` to denote the constructor.  This patch simply aliases it to
`__construct`, which ease.js handles as it would normally.

To that note, since the ES6 `class` keyword is purely syntatic sugar around
the prototype model, there is not much benefit to using it over ease.js if
benefits of ease.js are still desired, since the member definition syntax is
a feature of object literals:

```
// ease.js using ES6
let Person = Class(
{
    _name: '',

    // note that __construct still works as well
    constructor( name ) {
      this._name = ''+name;
    },

    sayHi() {
      return "Hi, I'm " + this.getName();
    },

    // keywords still work as expected
    'protected getName'() {
      return this._name;
    }
} );

// ES6 using `class` keyword
class Person
{
    // note that ES6 will _not_ make this private
    _name: '',

    constructor( name ) {
      this._name = ''+name;
    },

    sayHi() {
      return "Hi, I'm " + this.getName();
    }

    // keywords unsupported (you'd have to use Symbols)
    getName() {
      return this._name;
    }
}

// ES3/5 ease.js
var Person = Class(
{
    _name: '',

    __construct: function( name ) {
      this._name = ''+name;
    },

    sayHi: function() {
      return "Hi, I'm " + this._name;
    },

    'protected getName': function() {
      return this._name;
    }
} );
```

As you can see, the only change between writing ES6-style method definitions
is the syntax; all keywords and other features continue to work as expected.
2015-09-16 00:02:00 -04:00
Mike Gerwitz a931796bdf Prototype wrapping using index function
This redefines the index as a function (rather than a vanilla object) so
that it may be invoked to yield an ease.js Class that wraps the given
prototype.
2015-09-09 23:36:14 -04:00
Mike Gerwitz 1fe8a0e8d6
Remove interactive.js jQuery dependency
Importantly, this also removes loading from ajax.googleapis.com, which is a
problem, because the domain must be allowed using NoScript, and hosts many
other things.

Why this was added to begin with is beyond me.  Perhaps it demonstrates my
novice abilities back in the day.
2015-08-23 00:37:24 -04:00
Mike Gerwitz 62f7e0111a
README.md et. al. restructuring
There is now only one README* file---README.md.  Other files have been
renamed (e.g. README.hacking=>HACKING), or consolidated.
2015-08-23 00:15:48 -04:00
Mike Gerwitz 4a61781701
Browserify fix 2015-08-14 14:00:27 -04:00
Mike Gerwitz fdc2f2e3c3 __dirname removal from index.js
This satisfies Browserify, which apparently does not like __dirname
2015-08-14 13:46:20 -04:00
Mike Gerwitz 1d828b7ee2
LibreJS license header for doc/interactive.js 2015-07-06 23:42:53 -04:00
Mike Gerwitz b91d243e2b
package.json updates 2015-05-28 23:55:19 -04:00
Mike Gerwitz a1c2fbeaa4 package.json engines removed; unnecessary 2015-05-28 23:54:35 -04:00
Mike Gerwitz 32d004bee7 package.json repo URL update to HTTP
Browsable and less likely to be blocked by corporate firewalls.
2015-05-28 23:53:32 -04:00
Mike Gerwitz 6c6a3af03d package.json author e-mail update 2015-05-28 23:50:37 -04:00
Mike Gerwitz 579527d168
Class is not a needed dependency for Interface 2015-05-28 01:23:52 -04:00
Mike Gerwitz db3ade378a
[copyright] Copyright update 2015-05-28 01:01:51 -04:00
Mike Gerwitz 7ce57b7d97
Trait class extend support 2015-05-28 00:01:24 -04:00
Mike Gerwitz c27400ca83 README.traits "Trait Extending" section update to reflect class extension support 2015-05-27 23:40:30 -04:00
Mike Gerwitz f3a8dea25d Test ensuring `#use` staging object satisfies `Class.isClass` 2015-05-27 23:38:07 -04:00
Mike Gerwitz 867127ed2f Trait class extension support
"Extending" a class C simply creates a contract stating that the trait may
only be mixed into something of type C (so, C or its subtypes).
2015-05-27 23:23:47 -04:00
Mike Gerwitz 96c5a702ce Abstract mixin initial implementation 2015-05-27 23:23:47 -04:00
Mike Gerwitz 5b6a0c0bb5 "lazy" metadata support 2015-05-27 23:23:47 -04:00
Mike Gerwitz e866f53d4c Remove global _extending state
The previous implementation could not survive recursive applications, which
I did know about.  But that was before the system was brutally abused by
traits.
2015-05-27 23:23:47 -04:00
Mike Gerwitz 69e9828beb Object class masquerading 2015-05-27 23:23:47 -04:00
Mike Gerwitz 98e76be94f
Implementation note on this.__super scope with private method calls 2015-05-27 23:23:26 -04:00
Mike Gerwitz c896bdbc27
.mailmap updated with mtg@gnu.org 2015-05-11 23:11:25 -04:00
Mike Gerwitz 1ed7bd0e8b
package.json syntax correction (oops)
Was not able to rebase because I already stupidly pushed, and Savannah does
not allow --force, or deleting `master' to circumvent. ;)  Not that it would
be a good idea rergardless.
2015-05-10 01:39:12 -04:00
Mike Gerwitz d955d6e86a
package.json keyword additions and corrections 2015-05-10 01:27:27 -04:00
Mike Gerwitz a3add011fb package.json keyword additions
This list has also been sorted, so pay close attention to the diff.
2015-05-10 01:27:10 -04:00
Mike Gerwitz dcbe48d982 package.json {tags=>keywords}
Was the key "tags" in the past?  Regardless, it doesn't work [anymore], so
ease.js keywords haven't been searchable in npm for quite some time /
forever.
2015-05-10 01:24:22 -04:00
Mike Gerwitz fcdfae68b2
tools/copyright ignore `.|..' 2015-05-06 22:36:52 -04:00
Mike Gerwitz 991f4086fa
Remove Trait/ParameterTest ctor ordering comment (since resolved) 2015-05-06 22:32:55 -04:00
Mike Gerwitz 313a51d750
README TODOs using Org mode
Even if you don't use Emacs, the outline style should be intuitive.

This commit is partially for organization, partially to let people
know that this project is still on my mind and will be getting more
attention soon.
2014-12-19 22:25:18 -05:00