Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

What are you doing with JScript.NET?

Until recently I pretty much resented JScript programming.  Recently I've had second thoughts.  I wondered if others have found the same.

In the past I only used JScript for Browser Side coding (and cross browser code which is a big time waste).

This year I've been mostly working in VB.NET and C#.  I 've used a little JScript.NET (basically because it could "eval" easily and the other languages couldn't).  I used it to implement classes of objects where each instance has a function as a member (code is held in a database from which instances are rehydrated).

These languages (C# and VB.NET) are very similar and I sometimes miss the power/freedom/discipline of the so called "scripting languages".  (Don't get me wrong the "strongly typed fascists" have an important place in the world.)

I was wondering what interesting stuff other people are doing with JScript.NET (object design on the fly, passing functions around and Lambda's) that C# and VB.NET can't handle.

Mike Gale
Wednesday, October 16, 2002

I'm curious about the project you had where you stored code in a database. What was that for?

Luke Duff
Wednesday, October 16, 2002

Hi Mike,

Thanks for asking. I helped design and implement JScript .NET, so I am very interested to see what people have to say.

Perhaps you can get the ball rolling by telling us what you use "eval" for.  "eval" has always been a double-edged sword.  On the one hand, the ability to write self-modifying code is clearly extremely cool and extremely powerful.

On the other hand (a) there is almost always a way to solve the problem more efficiently without eval, (b) take it from me, generating efficient code for a self-modifying language is extremely difficult, and (c) eval enables sloppy programmers to write absolutely nightmarish security vulnerabilities into their code.

So I'm always curious as to what people use this feature for.  What are you using it for?


Eric Lippert
Wednesday, October 16, 2002

I've been making an swf file generator, and have been tinkering with mapping JScript to swf bytecode rather than Actionscript (it is very similar, but JScript has much better oo support, etc.). Ideally it could generate bytecode from any CLS compliant code (I'm using CodeDom graphs), but JScript is the fall back.

Actionscript doesn't Eval code, only identifiers, so I get off the hook there. I did have to use eval a few times making a class registry system, only due to quirks in the flash player. The registry is needed to map the oo support in the cls (it is here:
...but the JScript part is only part done)

It is also very cool that you can see the JScript implementation written in C# in Rotor! A big honor to meet you Eric : ).

Robin Debreuil
Wednesday, October 16, 2002

Eric and Luke,

I won't go into a lot of detail.

The application implements a "data flow concept net".  This is originally an approach to "expert systems".  I've been waiting for years to find an acceptable way to implement these things.  (I had it working in interpreted script but performance was poor in realistic cases.)

In these the "author" basically creates a system that is responsive to inputs, solves for goals and represents results as numbers and text.  Part of the "authoring" process involves defining "concepts" which include an arbitrarily complex computation.

I've been frustrated for a long time (especially when I see glowing discussion of "rule based" and "neural net" systems which can't do the stuff I'm interested in!), so this is a kind of catharsis.

(I got quite concerned when I sniffed that JScript.NET might be under the axe.  I've been looking forward to making some time in the next year to get to grips with it's power.  What I really want to see is JScript become a full "Visual Studio language" like C# and VB.NET [which between them have been my focus most of this year].)

Mike Gale
Wednesday, October 16, 2002

*  Recent Topics

*  Fog Creek Home