[Mono-list] Re: Javascript and Mono

Steve Newman steve@snewman.net
Mon, 6 Jan 2003 11:46:31 -0800


At 19:48:15 +0100 1/6/03, Jeroen Janssen <japj@xs4all.nl> wrote:

> >`AddTwoThings' is just a helper function.  And the whole assembly is
>>packed with helper functions that the compiler uses.
>>
> >C# uses very very very few helper functions from assemblies.
>
>Ok, we will need to look if JScript also needs helper functions like these.

Yes, I think you will find that Microsoft's JScript is using helper functions.  At any rate, I don't know how you would implement J[ava]Script without them, because (unlike C#) there is a lot of potentially complex logic implied in basic operations like "+" -- see Miguel's AddTwoThings example.

In the JANET source, the files JPrimitive.cs, JObjects.cs, and JRuntime.cs are essentially all "helper code" in this sense.  The other files are only needed for compilation (and operations like "eval"), but these three files, two of which are fairly large, are needed to support the compiled code.

One key point is that currently, JANET generates a call to the support library for every operation.  This is because so far I've only implemented ECMAScript 3, which doesn't include type declarations.  In JScript, you may have type information at compile time, in which case the support library operations can often be optimized away.  I haven't tried to address that yet in JANET.

Slightly off-topic: can anyone point me at a complete specification for JScript.NET?  Failing that, is there a reasonably complete reference manual that can be used in lieu of a specification?  The last time I looked on the Microsoft site (which was a while ago), all I could find was a brief "introduction to JScript" -- not very satisfying if you're trying to produce your own language implementation.

-- Steve