Re: Javascript: Time Traveller From the Year 1962!

[prev] [thread] [next] [lurker] [Date index for 2005/04/09]

From: peter (Peter da Silva)
Subject: Re: Javascript: Time Traveller From the Year 1962!
Date: 14:01 on 09 Apr 2005
> > Namespaces?

> > Uh, Javascript is a template-based OO language.

> > Every object is a namespace!

> Oh yeah.  But without a way to load other files its rendered largely useless. 

Oh, geeze, you want to shove a bunch of eval into the core of JS as well,
like some kind of sausage stuffed with boar nostril hairs and floor sweepings?

If you want a language built around eval, use a Lisp-derived language like
Tcl. It's a great model, I enjoy it a lot, but it's not what Javascript is
about. You need to embed your JS in that kind of framework, not a browser.

Let's say JS had a "script" object, and

script.include("URI");

Now when you're running JS as a command line scripting language, what do you
do? Well, you start writing code like:

script.include("file:///.../foo.js"):

And now you're going to have to eval that at runtime (no precompiled code
for us). What you really want here is:

#include "foo.js"

But that doesn't make sense in a browser, whereas the <script source=...>
stuff does. Does it suck that JS is bound to the browser model? Why yes, I
already noted that myself. But it's not something you can fix at the
language level until you're working with a non-browser environment.

So either you drag the whole browser environment, INCLUDING the HTML, into
the command line, or else you jettison the whole browser-based file framework
and start over with something else that actually makes sense.

I can't conceptually see a better option, really, than something like:

document.write("<script source=\"include.js\"></script>");

Which brings us full circle.

Generated at 12:00 on 12 Apr 2005 by mariachi 0.52