require() ?
Attila Szegedi
attila.szegedi at oracle.com
Mon Dec 24 09:55:15 PST 2012
Well, here's my take. I originally implemented the require() function in Rhino, and I also set out - earlier this year - to implement it in Nashorn. However, I quickly run into issues. For Rhino I implemented the CommonJS Require/1.1 specification, but Node happens to significantly deviate from that spec. Picking one over the other would make the other harder to introduce for those people who'd need it; also we'd be stuck having to track and keep that standard up to date. The Node implementation differs significantly, so that trying to create a unified implementation ended up having an uncomfortable number of "if(useNodeSemantics)" statements in it (I did set out on that path to see where it leads). Finally, we decided to provide neither implementation as a built-in, and restrict ourselves to be a vanilla ECMAScript runtime instead. We have an in-house port of Node, and people who work on it provide require() in it.
Attila.
Sent from my iPad
On 2012.12.23., at 16:10, Brice Ruth <bruth at flexion.us> wrote:
> Good morning.
>
> First, congrats on a first public release to the OSS community. What a
> pleasant gift for the holidays!
>
> I was going to give nashorn a spin by seeing if I could get coffee-script
> (git://github.com/jashkenas/coffee-script.git) running. Unfortunately,
> nashorn is complaining that require() is not defined. Is require() node
> specific? I thought for some reason Rhino understood the require() syntax
> as well?
>
> Thanks & again, congratulations!
>
> Brice
>
> --
>
>
>
> ------------------------------
> *Notice*: The information contained in this message or any attached
> document is confidential and intended only for individuals to whom it is
> addressed. If you got this message in error, please inform me immediately
> using one of the methods above. In some cases, I may ask you to return the
> documents at my expense. In general, please simply destroy the information
> at once. Any unauthorized use, distribution, or copying of this information
> is prohibited.
More information about the nashorn-dev
mailing list