This adds the `weak' keyword and permits abstract method definitions to
appear in the same definition object as the concrete implementation. This
should never be used with hand-written code---it is intended for code
generators (e.g. traits) that do not know if a concrete implementation will
be provided, and would waste cycles duplicating the property parsing that
ease.js will already be doing. It also allows for more concise code
generator code.
Note that, even though it's permitted, the validator still needs to be
modified to permit useful cases. In particular, I need weak abstract and
strong concrete methods for use in traits.
This just saves some time and memory in the event that the trait is never
actually used, which may be the case in libraries or dynamically loaded
modules.
As described in <https://savannah.gnu.org/task/index.php#comment3>.
The benefit of this approach over definition object merging is primarily
simplicitly---we're re-using much of the existing system. We may provide
more tight integration eventually for performance reasons (this is a
proof-of-concept), but this is an interesting start.
This also allows us to study and reason about traits by building off of
existing knowledge of composition; the documentation will make mention of
this to explain design considerations and issues of tight coupling
introduced by mixing in of traits.
Note the incomplete tests. These are very important, but the current state
at least demonstrates conceptually how this will work (and is even useful in
its current state, albeit dangerous and far from ready for production).
This is a rough concept showing how traits will be used at definition time
by classes (note that this does not yet address how they will be ``mixed
in'' at the time of instantiation).
More generally, this was a problem with not recursing on *all* of the
visibility objects of the supertype's supertype; the public visibility
object was implicitly recursed upon through JavaScript's natural prototype
chain, so this only manifested itself with protected members.
The check/test/test-suite make targets can still be used, but this at least
allows running specific test cases from the command line, which is extremely
useful during development.
This reverts commit e0790b5281.
It is better to leave this out, because the availability of the combined
source file will trigger the combined test cases, which in turn makes
test-driven development frustrating because you are spammed with combined
errors, which duplicates the first-encountered case error.
All test cases are now part of the xUnit-style suite, have been cleaned up
significantly, and all tests now include rationale in the preceding
docblock.
This project invests a great deal of time into testing; I trust that it
shows in its quality and stability.
Holy hell that was a long and tedious process. It's nice to finally have
everything in the new test suite.
Still plenty of work to be done with refactoring (both the library and test
cases), though.