A Narcissus implementation of various object literal extensions
I've been playing with this:
which has a web interface to try out code examples here:
On Mon, Aug 15, 2011 at 2:58 PM, Rick Waldron <waldron.rick at gmail.com> wrote:
I've been playing with this: zaach/reflect.js which has a web interface to try out code examples here: zaach.github.com/reflect.js/es-next
Rick
It works for simple examples but has a ways to go before it can run the Smalltalk Collection classes. Also, AFAICT "transpilation" won't be able to fully support super references (namely, rebinding super using Object.defineMethod) but it can take us pretty far. The other features seem attainable.
On Aug 15, 2011, at 5:42 PM, Zachary Carter wrote:
It works for simple examples but has a ways to go before it can run the Smalltalk Collection classes. Also, AFAICT "transpilation" won't be able to fully support super references (namely, rebinding super using Object.defineMethod) but it can take us pretty far. The other features seem attainable.
You should be able to come up with a way rebind super for defineMethod. The first thing that comes to mind is to attach a "private" property to each function that references super. The value of the property is a function that creates a new function using the same code but with a different internal binding for super.
However, to transpile <| you really need to have proto available so an implementation without it (IE9, etc.) couldn't be a target.
In the fork of Narcissus at allenwb/narcissus I have implemented various ES.next proposals (and a couple not yet proposals) for enhanced object literal support. the extensions include:
(see allenwb/narcissus/blob/master/harmony-extensions.md for more details on the specific extensions)
With these extensions I am able to "compile" the version of my Smalltalk Collection classes experiment that is at allenwb/ESnext-experiments/blob/master/exp1-nc-narcissus.js
The best way to evaluate new language features is to actually use them. Please feel free to install this of Narcissus and try using the njs shell to write and run some code that uses these new features and then give us your feedback.