News for hackers. Stuff that matters.
Re:JavaScript needs modules by wslh on Thursday July 08, 2010 @08:54PM (#1499321)
It's a shame that somebody point at this obvious feature on 2010. Javascript lacks a lot of features from scripting languages.
Re:JavaScript needs modules by jmillikin on Thursday July 08, 2010 @08:59PM (#1499330)
Javascript is a scripting language -- and off the top of my head, I can't think of any scripting language with modules (maybe VBScript?)
Re:JavaScript needs modules by lunchbox on Thursday July 08, 2010 @09:48PM (#1499425)
Python, Perl, Ruby, Lua, R, Matlab, etc...I can think of more that do than don't.
Re:JavaScript needs modules by jmillikin on Thursday July 08, 2010 @09:52PM (#1499437)
None of those are scripting languages, except maybe Matlab -- I haven't used it enough to say.

Just because a language is dynamically typed doesn't make it a "scripting language".

Re:JavaScript needs modules by silentbicycle on Thursday July 08, 2010 @11:21PM (#1499639)
What? Lua isn't a scripting language? Can you flesh that out a bit?

(So is TCL, but I don't think it has a module system.)

Re:JavaScript needs modules by jmillikin on Friday July 09, 2010 @12:14AM (#1499757)
Lua is a full programming language -- you can use it to write a complete application without depending on external third-party tools.

I usually take "scripting language" to mean "a language only suitable for combining pre-written components", since that seems to be the only useful definition. Other definitions are too broad (containing such languages as Python, Java, Haskell, and Forth) or too narrow (excluding QuakeScript, JavaScript, or Bash).

In particular, I refuse to call any language a "scripting language" merely because it uses dynamic typing, implicit compilation, or high-level concepts.

Re:JavaScript needs modules by catch23 on Friday July 09, 2010 @05:21AM (#1500188)
I think your definition is wrong, just go with wikipedia's definition: http://en.wikipedia.org/wiki/Scripting_language

Javascript can be run at the command-line just like ruby, python, and the rest. You can write a full application in pure javascript without depending on external third party tools too -- see stuff like nodejs.

Also, I don't know of anyone that would consider Haskell to be a scripting language. If we consider Haskell a scripting language, we might as well consider Java, C, C++ to be scripting languages too...

Re:JavaScript needs modules by jmillikin on Friday July 09, 2010 @11:10AM (#1500864)
According to the Wikipedia definition, Haskell is a scripting language (it can be dynamically typed, interpreted, embedded, etc). That's why I don't think it's a useful definition.

How do you write a full application in JavaScript? The language doesn't even define any way to open a file. NodeJS is a third-party tool -- it's not part of the JavaScript language.

Re:JavaScript needs modules by silentbicycle on Friday July 09, 2010 @12:48PM (#1501238)
While I agree that "scripting language" is a bit loosely defined (though nothing like "object-oriented"), Lua was written with a "hard and soft layers" (http://c2.com/cgi/wiki?AlternateHardAndSoftLayers) approach in mind. To me, that seems like the defining characteristic of a scripting language.

I'm not saying Lua isn't a full programming language - it's actually my language of choice for day-to-day hacking, supplemented with C as necessary. It was clearly designed to accommodate projects where it isn't primary language, though.

Re:JavaScript needs modules by melvin on Thursday July 08, 2010 @10:06PM (#1499457)
Dynamically typed, no. Interpreted, yes.
Re:JavaScript needs modules by jmillikin on Thursday July 08, 2010 @10:47PM (#1499561)
JavaScript is typically implemented with a JIT compiler, just like Java or C#. Python, Ruby, and Lua use virtual machines (like Java used to be).
Re:JavaScript needs modules by jonhohle on Friday July 09, 2010 @02:15AM (#1499920)
That's why I've always maintained that Java is a scripting language ;)
Re:JavaScript needs modules by catch23 on Friday July 09, 2010 @05:24AM (#1500189)
typically? JIT for javascript is only a semi-recent innovation. I'd say most javascript runtimes pre-2009 didn't have a JIT.

> (like Java used to be)

So Java doesn't run on a virtual machine anymore?

Re:JavaScript needs modules by tung on Thursday July 08, 2010 @09:43PM (#1499412)