Permalink
Commits on Oct 26, 2015
  1. 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.
    committed Oct 26, 2015
Commits on Oct 25, 2015
  1. 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.
    committed Oct 23, 2015
Commits on Oct 17, 2015
  1. 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.
    committed Oct 17, 2015
Commits on Sep 16, 2015
  1. ES6-style constructor documentation

    Shame on me for not including this in the previous merge!
    committed Sep 16, 2015
  2. 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.
    committed Sep 16, 2015
  3. ES6-style constructors

    Included with this change is a simple "wrapper" implementation:
    
    ```
    // equivalent
    easejs( Foo );
    Class.extend( Foo, {} );
    ```
    committed Sep 16, 2015
  4. 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.
    committed Sep 15, 2015
Commits on Sep 10, 2015
  1. 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.
    committed Sep 10, 2015
Commits on Aug 23, 2015
  1. 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.
    committed Aug 23, 2015
  2. 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.
    committed Aug 23, 2015
Commits on Aug 14, 2015
  1. Browserify fix

    committed Aug 14, 2015
  2. __dirname removal from index.js

    This satisfies Browserify, which apparently does not like __dirname
    committed Aug 14, 2015
Commits on Jul 7, 2015
Commits on May 29, 2015
  1. package.json updates

    committed May 29, 2015
  2. package.json repo URL update to HTTP

    Browsable and less likely to be blocked by corporate firewalls.
    committed May 29, 2015
Commits on May 28, 2015
  1. [copyright] Copyright update

    committed May 28, 2015
  2. Trait class extend support

    committed May 28, 2015
  3. 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).
    committed May 28, 2015
  4. "lazy" metadata support

    committed May 24, 2015
  5. 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.
    committed May 13, 2015
  6. Object class masquerading

    committed May 13, 2015
Commits on May 12, 2015
Commits on May 10, 2015
  1. 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.
    committed May 10, 2015
  2. package.json keyword additions

    This list has also been sorted, so pay close attention to the diff.
    committed May 10, 2015
  3. 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.
    committed May 10, 2015