1
0
Fork 0
Commit Graph

1179 Commits (55f47a3c5a1af6dcdb9656201eb4b2750bb34723)

Author SHA1 Message Date
Mike Gerwitz 55f47a3c5a
Correct Trait#__inst in ES3 environments
The previous commit's test case failed in ES3 environments.  I'd amend that
commit, but Savannah refuses force pushes, and I can't work around that on
`master'.

* lib/Trait.js (tctor): Assign `__inst' to the public visibility object
  rather than `vis'.
2017-11-04 00:34:00 -04:00
Mike Gerwitz 5c3b7ab042
Modernize documentation examples
Despite working with ES3+, the perceived age of the project is probably a
deterrent, and we really should be showing users the modern way of doing
things.

`impl-details.texi' was _not_ modernized because those details are indeed
specific to ES3.

* doc/classes.texi:
* doc/integration.texi:
* doc/interop.texi:
* doc/mkeywords.texi: Update documentation.
2017-11-02 00:52:00 -04:00
Mike Gerwitz bb3956f1b4
Fix trait __inst
`this.__inst' within trait methods will now correctly resolve to the public
visibility object of the class we're mixed into, rather than
`undefined'.  This behavior is consistent with the rest of the system.

* lib/ClassBuilder.js (initInstance): Add `inst' to private metadata.  This
  is the public visibility object.
* lib/Trait.js (tctor): Initialize concrete trait `__inst' to aforementioned
  `inst' metadata value.
* test/Trait/LinearizationTest.js: Add respective test.
2017-11-02 00:15:31 -04:00
Mike Gerwitz 05bb844f12
Ignore ChangeLogs in NEWS
* tools/gitlog-to-news: Account for ChangeLog entries in commit messages.
2017-10-29 00:07:50 -04:00
Mike Gerwitz 6c6e41c415
Add Class.assert{InstanceOf,isA}
* lib/class.js (assertInstanceOf, assertIsA): New methods.
* test/Class/GeneralTest.js: Add respective tests.
* doc/classes.texi (Type Checks and Polymorphism): Add reference for
    methods.  Update and format text.  Add indexes for "polymorphism",
    "type checking", and "duck typing".
2017-10-27 23:46:16 -04:00
Mike Gerwitz a3d01a65d9
Merge README with README.md
Having both is confusing.  I also think it might be confusing npmjs.org
(which isn't a good reason to modify my tree, but hopefully it'll be a nice
side-effect).

* README: Remove file.
* README.md: Absorb README.
2017-07-25 23:38:08 -04:00
Mike Gerwitz a35ecc6f94
Test parameterized traits with named staging object
* test/Trait/NamedTest.js: Add regression test.
  Update copyright to include 2017.
2017-06-30 02:06:36 -04:00
Mike Gerwitz ae196d5de5
HACKING: Note to write only ES3 2017-06-30 02:03:09 -04:00
Mike Gerwitz 90fd1a8d08
`override' implies `virtual'
This behavior is consistent with other OO languages like C++ and C# that do
not have virtual methods by default.

This solution isn't ideal, but I don't have time for a larger refactoring
right now.  I sat on this change for a good few weeks before committing it
unchanged.

* lib/MemberBuilderValidator.js (validateMethod): Allow override of
  supertype overrides.

* test/*: Stripped `virtual' keyword where appropriate.

* doc/classes.texi (Inheritance): Update to state that `override' implies
  `virtual'.
2017-06-30 02:01:40 -04:00
Mike Gerwitz 311118de81
Copyright 2017 year update on manual and headers
I'm starting to get old.  And so's ease.js.

* doc/easejs.texi: Add 2017 copyright year.
* tools/combine-test.tpl: Add 2017 copyright year.
* tools/license-min.tpl: Add 2017 copyright year.
* tools/license.tpl: Add 2017 copyright year.
2017-01-02 23:42:23 -05:00
Mike Gerwitz ab4874e285
Add constructor reference caveat to manual
* doc/classes.texi: Add caveat for referencing the constructor when using
  ES6-style naming.
2017-01-02 23:38:48 -05:00
Mike Gerwitz b841b9cc5e
Fix trait extending of supertype with constructor
Supertypes that extend constructors may now be extended by traits without
completely blowing up.  Good feature.

* lib/Trait.js (__tconstruct): Add function.
  (createVirtProxy): Use it.

* test/Trait/ClassExtendTest.js: Add test.
2017-01-02 23:34:29 -05:00
Mike Gerwitz 92c57c8ffe
Constructor virtual by default
* lib/ClassBuilder.js (_keywordParser): Make __construct virtual.
* test/Class/ConstructorTest.js: Add test.

* doc/classes.texi (Constructors): Update documentation.
2017-01-02 23:30:33 -05:00
Mike Gerwitz e39ff83b40
Rework constructor section in manual
My writing style has changed quite a bit since this was first written.

* doc/classes.text (Constructors):
  Reword section.
  Remove reference to static classes and singletons (we do not want to
    encourage such things).
  Add mention of good constructor practices.
2017-01-02 22:34:43 -05:00
Mike Gerwitz 35dacc00da Minor cleanup to trait naming test
test/Trait/NamedTest.js: Cleanup interface-related naming test.
2016-12-29 03:50:09 -05:00
Mike Gerwitz e93f3a70f9 Support for named trait class extending
We can call this a bugfix...it's more of a neglected feature that's
otherwise completely inconsistent with the rest of the system. :)

* lib/Trait.js (createNamedTrait): Support base.
  (_createStaging) [extend]: Support base.

* test/Trait/NamedTest.js: Add test.
2016-12-29 03:49:47 -05:00
Mike Gerwitz 017b85d75b
Copyright year updates for recent trait changes
* lib/Trait.js: Add Copyright year 2016.
* test/Trait/ContextTest.js: Add Copyright year 2016.
2016-12-29 03:11:49 -05:00
Mike Gerwitz 54b0c79fed
Rename Trait/{Scope=>Context}Test
This better reflects its focus.

* test/Trait/ScopeTest.js: Rename file (delete).
* test/Trait/ContextTest.js: Rename file (create).
2016-12-29 02:39:26 -05:00
Mike Gerwitz 04e98e682e
Correct trait->class calling context on class supertype
See test cases for more information.  This was a pretty unfortunate and
nasty bug that I discovered while working on a project that uses easejs; it
wasn't something that was found previously because this support was only
added relatively recently, and this problem does not exist if an interface
is used.

* lib/Trait.js (bindSuperCtx): Add function.
  (tctor): Use it.

* test/Trait/ScopeTest.js: Add calling context tests.
2016-12-29 02:39:16 -05:00
Mike Gerwitz 748ceaf0bf
Fix silly mix{o=e}r typo in Trait
* lib/Trait.js (_validateMixin): Change docblock and error message to
    resolve typo.
2016-12-28 03:07:29 -05:00
Mike Gerwitz 5130e41641
Add missing INSTALL
Autoconf generates INSTALL boilerplate, so I had added it to .gitignore in
the past.  Unfortunately, I do include my own INSTALL file, which is present
in the distribution, but has never been committed to the repo!

Thanks to Stefan Schweter for pointing this out to me.

* INSTALL: Added.
* .gitignore (/INSTALL): Removed.
2016-10-14 22:33:57 -04:00
Mike Gerwitz 53320e84a1
Fail mkrelease on npm publish failure
* tools/mkrelease: exit on failed `npm publish'
2016-07-21 01:24:45 -04:00
Mike Gerwitz 705f092eb0
Shorten combined min license header
* tools/license-min.tpl: Shorten software URL;
  use HTTPS; and use range for copyright years
2016-07-21 01:24:00 -04:00
Mike Gerwitz 07962af3af
Copyright year updates for combined files
* tools/*.tpl: Add 2015, 2016 to copyright years
2016-07-21 01:22:38 -04:00
Mike Gerwitz 04b620192d
Correct variable name in combined header
Clearly a bad case of search/replace.

* tools/combine.tpl: {util=>easejs}
2016-07-21 01:19:49 -04:00
Mike Gerwitz 18b2c13f7b
Update copyright years on main Texinfo manual page
* doc/easejs.texi: Add 201{5,6} to copyright years
2016-07-16 00:27:06 -04:00
Mike Gerwitz 9431efacfe
Add "Transparent error subtyping" to README
This also reorganized the list to match the website

* README.md: Added "Transparent error subtyping".
  Reordered list.
2016-07-16 00:01:09 -04:00
Mike Gerwitz c662106e86
Copyright year update on classes.texi
* doc/classes.texi: Add 2016 to copyright
2016-07-15 23:43:21 -04:00
Mike Gerwitz ef5eade499
Add "Class Caveats" manual section
This will grow.

* doc/classes.texi (Class Caveats): Added with `this.__inst' documentation
2016-07-15 23:35:36 -04:00
Mike Gerwitz 30e7feefc9
Remove strong recommendation for `public' in manual
* doc/classes.texi (Defining Classes): Remove the recommendation for using
  the `public' keyword always (instead of omitting it), and the reference
  stating that it may be required in the future.  This is not the case.
2016-07-15 13:40:15 -04:00
Mike Gerwitz 86df50d1ca
Transparent Error Subtyping
Error subtyping (creating your own error types) in ECMAScript is notoriously
crude, and getting it to work intuitively is even harder.  ease.js will now
transparently handle all necessarily boilerplate when extending Error or its
subtypes.

Take, for example, the common boilerplate for creating your own Error type:

```javascript
    function ErrorSubtype( message )
    {
        var err = new Error();

        this.name         = 'ErrorSubtype';
        this.message      = message || 'Error';
        this.stack        = err.stack;
        this.lineNumber   = err.lineNumber;
        this.columnNumber = err.columnNumber;
        this.fileName     = err.fileName;
    }

    ErrorSubtype.prototype             = new Error();
    ErrorSubtype.prototype.constructor = ErrorSubtype;
```

There are a number of problems with this:

  - That's a lot of boilerplate for any type you wish to create;
  - Some of those features may not be supported by your environment
    (e.g. column numbers or stack traces);
  - The stack trace will include `ErrorSubtype` _itself_ (as the top frame);
    and
  - Consequently, the `{line,column}Number` and `fileName` will represent
    that top frame---the error constructor itself.

With ease.js, it's just like extending any other class/constructor:

```javascript
    Class( 'ErrorSubtype' )
        .extend( Error, {} );
```

More information can be found in the "Error Subtypes" section of the manual.

Happy Error hacking.  Maybe you'll actually want to create them now.
2016-07-15 00:21:55 -04:00
Mike Gerwitz a7e1d2ad70
Error constructor integration into ClassBuilder
This introduces the transparent subtyping.

* doc/classes.texi (Error Subtyping): Section added

* lib/ClassBuilder.js (ClassBuilder): Accepts ErrorCtor instance
  (build): Transparent Error subtyping

* lib/class.js: Provide ErrorCtor instance to ClassBuilder

* test/ClassBuilder/ErrorExtendTest.js: Add test case for transparent error
  subtyping
2016-07-15 00:21:06 -04:00
Mike Gerwitz d99ab2e5fb
Error constructor `after' support
* lib/ctor/ErrorCtor.js (createCtor): Add `after' parameter to be
  invoked by `__$$ector$$__' at end of function.

* test/ctor/ErrorCtorTest.js: Add respective tests.
2016-07-15 00:18:42 -04:00
Mike Gerwitz c69a42945c
Add error constructor generator
This produces the constructor used for Error subtypes.

* lib/ctor/ErrorCtor.js: Added
* test/ctor/ErrorCtorTest.js: Added
2016-07-15 00:18:37 -04:00
Mike Gerwitz 37a459a25a
Add autogen.sh
* autogen.sh: Added
2016-04-21 22:42:10 -04:00
Mike Gerwitz 30f769b919
package.json licence field update to GPL-3.0+
Apparently the SPDX license list used by NPM supports an "or later"
identifier; that's good, as this is an incredibly important distinction; I
was otherwise going to drop it and use my own custom identifier.

* package.json: License field set to GPL-3.0{=>+}
2016-04-06 19:34:00 -04:00
Mike Gerwitz 818e4a73c8
whyfreejs link in README.md 2015-12-28 00:06:04 -05:00
Mike Gerwitz 9a19ff0218
package.json license field update
This uses the newer style.  Note that the license syntax does not support a
very important part of the license---"or later"; this is actually GPLv3+.
2015-12-24 00:08:21 -05:00
Mike Gerwitz 2f3639f776
Minor build improvements 2015-12-22 23:06:27 -05:00
Mike Gerwitz 12adc9954d {default=>all} target
Latter is recognized by Automake.
2015-12-22 23:04:31 -05:00
Mike Gerwitz 7dfb288ba7 dia check via configure 2015-12-22 22:52:04 -05:00
Mike Gerwitz d4478cdcd1
distcheck target fix
`make distcheck` now works as expected (does not fail).
2015-12-22 11:45:14 -05:00
Mike Gerwitz bb1ea6c476
Makefile.am reproducibility (test cases)
This is not strictly necessary (since order-modules does it), but let's be safe.
2015-12-22 10:41:34 -05:00
Mike Gerwitz e328445e5d
configure.ac reproducibility
Remove non-determinism from filesystem.
2015-12-22 10:23:23 -05:00
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