Microsoft.JScript

  • Thread starter Thread starter Giulio Petrucci
  • Start date Start date
G

Giulio Petrucci

Hi there,

as I need to share a .NET context with a JavaScript context and I can't
re-write Rhino in C# ;-) I'trying to understand something about the
Microsoft.JScript namespace, but - really - I'm getting in *deep*
troubles: the documentation is not-so-well written (missing examples,
snippets, references, details and so on) so: can anyone:
1) Explain in 12-words ;-) *what* is Microsoft.JScript and *how* can I
use its classes;
2) link me to a tutorial or any other resource ("for dummies", of course);-)

Thanks in advance!

Cheers,
Giulio - Italia
 
JScript is Microsoft's "server-side" .NET, strongly typed implementation of
Javascript. It is fully .NET CLR compliant. Not sure what you mean about the
sharing of contexts, if your "Javascript context" means "client script" then
this won't do it - it doesn't run like interpreted Javascript in the browser.
Peter
 
Giulio Petrucci said:
Hi there,

as I need to share a .NET context with a JavaScript context and I can't re-write Rhino in
C# ;-) I'trying to understand something about the Microsoft.JScript namespace, but -
really - I'm getting in *deep* troubles: the documentation is not-so-well written (missing
examples, snippets, references, details and so on) so: can anyone:
1) Explain in 12-words ;-) *what* is Microsoft.JScript and *how* can I use its classes;
2) link me to a tutorial or any other resource ("for dummies", of course);-)

Thanks in advance!

Cheers,
Giulio - Italia


You might get better answers when posting to: microsoft.public.dotnet.languages.Jscript

Willy.
 
Hi Willy,

Willy Denoyette [MVP] ha scritto:
You might get better answers when posting to:
microsoft.public.dotnet.languages.Jscript

I'll try.
Anyway: I don't need informations about the JScript language, but about
the classes of the Microsoft.JScript namespace.

Thanks for your suggestion,
Giulio
 
Hi Peter,

Peter Bromberg [C# MVP] ha scritto:
Not sure what you mean about the
sharing of contexts, if your "Javascript context" means "client script" then
this won't do it - it doesn't run like interpreted Javascript in the browser.

I don't need to use any browser, don't worry ;-)
Let me explain better the scenario I'm currently dealing with. I have an
application with it's own context (implemented with a class called
ApplicationContext, could it be a good solution?) with some variables
and so on. Let's say[1]:

int foo = 3;
string bar = "this_is_bar";

Within this context there are some conditions defined by the user with
some javascript code: when they're executed the application can use them
as logical seitches (i.e. if such a condition is true, then do
something, else do something else). Moreover, user can define some
JavaScript functions that can be called within those conditions. Let's
suppose I have this function:

function f(a)
{
return a*a;
}

and a condition using this function, let's say:

function condition_1()
{
if (bar=="this_is_bar")
return f(foo);
else return foo;
}

as you could see in these scripts the user has defined some "logical"
using elements (foo,bar) belonging to the application context; moreover
there are cross-references between these scripts. If I use a dynamic
JScript compilation (and I won't talk about the loss of performance that
it brings). So I should implement something to make this JavaScript
context "talk" with my .NET application, and allow cross-reference
across the same JavaScript context.
Any suggestion?

Thanks in advance,
Giulio

--
[1] : actually I mapped all the variables to instances of a Variable
class I defined, that allow application to treat variables as they're
dynamic (or a sort of). So I actually have:

Variable foo = new Variable(3);
Variable bar = new Variable("this_is_bar");

In this way I can create assembly compiling dinamically the js code,
adding functions (invoked by reflection) taking objects as parameter
just to update the variables values as those Variable objects are
changed. In this way, i.e. compiling each js function into an assembly I
cannot use cross-referece, so I actually have *no* js context. So i
thought to compile all the functions within the same assembly. It's
functional but not so elegant. Moreover the dynamic compilation takes a
looooooooooooooooooong time ;-)
 
Mark Rae ha scritto:
Google is your friend:

yep, anyway as I told before, the msdn documentation about this
namespace is quite unuseful.

Bye,
Giulio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top