5 ms·
JavaScript is "assembler with closures and broken hashtables", and I don't get why anyone would want to use it on the server, compared to richer languages.
by pwpwp 17y ago
JavaScript is "assembler with closures and broken hashtables", and I don't get why anyone would want to use it on the server, compared to richer languages.
- lsd5you 17y agoWell there is the prototype programming model, which in terms of power of expression can be considered an advance over class based models.
- pwpwp 17y agoPrototypes vs classes is a matter of taste, and I don't think "power of expression" can be measured.
- mbrubeck 17y agoI think lsd5you is probably referring to the fact that you can trivially build classes on top of prototypes, while the reverse is not generally true (as far as I know). So a prototype-based language can easily express both classes and other forms of OO.
- lsd5you 17y agoYeah, although the trade off is that as class construction is procedural with prototypes you know longer have a declarative type system. Any type checking will have to come from type inference (when possible).
- btilly 17y agoSorry, but it isn't that hard to build prototypes on top of classes in a dynamic language. The cleverest and shortest implementation I've seen is http://snippets.dzone.com/posts/show/3378 http://snippets.dzone.com/posts/show/3378 where the following snippet of Ruby code does it: Proto = Class.new(Class) # Beware: magic. def Proto.clone Class.new(self) end (Follow the link for an explanation of usage.) However several other languages have implementations. For a random example see http://search.cpan.org/~teverett/Class-Prototyped-1.11/lib/Class/Prototyped.pm http://search.cpan.org/~teverett/Class-Prototyped-1.11/lib/C....
- buddycasino 17y agoExactly, like game developers starting to write their 3D engine in Lua. I don't get it.
- ludwig 17y agoAny sources for that? I know Lua is often used as a scripting language in 3D games since it is very easy to embed a Lua interpreter into your game. If you haven't seen it, you should take a look at the lua source code. It's beautiful. Essentially, you are making a nice internal API to your engine objects that you can manipulate, and experiment with, on a higher level without recompiling your application all the time. Python is also nice for this purpose (see OGRE 3D), but it's not as lightweight as Lua. So in a sense, it's better to use Lua for parts of your engine that will change a lot, depending on what aspect of the engine you are a focusing on at the moment (like tweaking how the enemy A.I. works, for example). This is especially useful at the prototype stage of your application. Is that what you had in mind, or am I mistaken?
- gaius 17y agoI sometimes wonder why Lua when Tcl already existed, but I've never used Lua.
- gruseom 17y agoThis interview addresses that: http://www.techworld.com.au/article/260022/-z_programming_languages_lua http://www.techworld.com.au/article/260022/-z_programming_la... We needed an easy-to-use configuration language, and the only configuration language available at that time (1993) was Tcl. Our users did not consider Tcl an easy-to-use language. So we created our own configuration language. Given how different Lua ended up, though, I imagine there was more to it than that.
- krakensden 17y agoLua is much closer (not visually) to the C/Java family languages, which makes it more approachable.
- 17y ago
- dutchflyboy 17y agoWell, have you ever tried to program in javascript? It's a fantastic language for prototyping. If you want to try an algorithm, you sit down, write an astonishly small quantity of code and it just works. That's just one of the reason why I use javascript. Another is, that it's a fantastic language to use for hobby projects, because you don't need to think too much beforehand, thanks to the dynamically typed variables, methods and objects. And last but not least, you don't have any GUI to manage. HTML does it for you, which simplifies matters a bit. You want to dynamically create HTML? No problem. You prefer to prepare the HTML beforehand? No problem at all. So to answer your question, I use it because it's refreshingly easy to use, more so than richer languages who are sometimes simply too heavy.
- pwpwp 17y agoBesides using JS on the server with Helma for some time, I even wrote a Lisp->JS compiler (CyberLisp) in JS. This project finally showed me that I don't want to use JS anymore. I agree with your point about prototyping, but I don't see why one would use a language that's good for prototyping, but sucks in the greater scheme, for web apps.
- DougWebb 17y agoThat's basically the same reasoning that applies to any server-side scripting language: high level scripting languages are much more efficient to develop with than more structured lower-level languages, and the web-application model lets you use HTML as your GUI which is quick, easy, and flexible (though not as rich or stable as client-side GUIs can be.) My personal preference for server-side development is Modern Perl, because it lets you develop anywhere along the "highly structured" to "rough scripting" line that you please. Other server-side languages are fine if they suit your development style, but I like to adjust my style to suit the project, and to use a language that can adapt to whatever style I need. Client-side, Javascript is great especially with jQuery. I couldn't deal with javascript development without selectors; it's far too much effort. I'll have to give Javascript a try for server-side development, but I don't think I'd want to do a large project in Javascript. My current application at work has nearly 7K lines of client-side Javascript, and it's already getting unwieldy.