3 ms·
Nice and thorough. I only have two qualms: 1. Reading through the Matz book on Ruby (http://oreilly.com/catalog/9780596516178/index.html http://oreilly.com/cat
by jballanc 18y ago
Nice and thorough. I only have two qualms:
1. Reading through the Matz book on Ruby (http://oreilly.com/catalog/9780596516178/index.html http://oreilly.com/catalog/9780596516178/index.html), there's a very good explanation as to why Ruby/Python/Perl are "scripting" languages as opposed to "programming" languages: no main! That is, whichever file is fed to the interpreter is run (with some exceptions) in order. So these are, and probably always will be, scripting languages.
2. The author vastly underestimates the importance of Javascript...
- jimbokun 18y agoInteresting way to define "scripting" languages. I didn't mean to underestimate JavaScript, which is why I gave it its own section. Perhaps I was too brief? Implication that its only useful in the browser?
- alecco 18y agoLove it or hate it, Javascript: * Is the language having the most important performance gains lately. * Growing support from both corporate (Yahoo, Apple, Google) and free software (Mozilla) camps. * Gains market with HTML 5 (just the canvas element alone makes a huge difference for JS based software.) * Better frameworks for both UI and client-server software. It's funny how things turn.
- catch23 18y agoYeah, it's strange how only 2 years ago or so, both ruby and javascript scored rock bottom on Alioth Shootout, with javascript scoring 4 times slower than ruby, and ruby 3 times slower than python. Two years later and there's 7 interpreters for ruby and 4 for javascript.
- silentbicycle 18y agoThere's something to be said for trying to make an expressive language and worrying about how to make it efficient later. Only working with stuff you know you can do efficiently can lead to getting stuck in local maxima.
- igouy 18y ago> ... rock bottom on Alioth Shootout ... Two years later ... Are they still rock bottom?
- jballanc 18y agoJavascript is a bit of an enigma. Usually, bad languages are made better (or at least tolerable) by the existence of good libraries (see C++, Perl). In the case of Javascript, it's a really elegant language made worse by being so often so dependent on the DOM and all of it's obscurities. I admire Javascript because it covers so many paradigms, and yet is, at the core, very simple and straightforward. Much as Lisp is to lists, Javascript is to hashes. Also, there are some really interesting projects in early stages that are taking Javascript out of the browser. For example, when Google released the code for v8, Marc-André Cournoyer from the Ruby community slapped together a project that translated Ruby to JS and ran it through v8 (http://macournoyer.wordpress.com/2008/09/02/ruby-on-v8/ http://macournoyer.wordpress.com/2008/09/02/ruby-on-v8/). Finally, I think it's worth noting that if you believe the "cloud" is the future, then Javascript is the de facto machine code of the "cloud"...
- kragen 18y agoSo if you can just put the main program statements into the file without wrapping it in a function or anything, it's a "scripting language", but if you have to wrap it in a main() function or something, it's not? That's a definition of "scripting language" that includes x86 assembly for MS-DOS .COM files as a "scripting language", but excludes VBScript macros for Microsoft Word, I think. Now, I don't know what you think, but these two languages seem to me to be almost perfect exemplars of the opposite extremes from how this definition would classify them. x86 assembly for .COM files has no type checking, no type coercion, no strings, no hash tables, very little in the way of runtime support (it pretty much owns the whole machine when it's running, under actual MS-DOS anyway, and you have to build everything yourself), takes months to learn enough about a computer to program in, typically is only used by fairly hard-core programmers, and there are no compatible interpreter implementations. VBScript is strongly dynamically typed, has strings, is used to "script" an existing application, runs in an interpreter, and is typically used by people who don't think of themselves as programmers. So I suggest that Matz's definition may not really express what people are normally thinking of when they say "scripting languages".
- jballanc 18y agoYes, but then people are conflating notions of type-system/runtime/vm/etc. with the notion of script vs. program. The key distinction is this: In a programming language you can only have one entry point (the "main()" function), regardless of how the individual files are linked. In a scripting language the entry point depends on which file the interpreter starts with, and the execution model can change depending on how the script is invoked. For example, the Ruby community uses this trick quite often so that one file can be a library if included by another source file, but can be an executable if invoked by the interpreter directly. See: http://gist.github.com/51337 http://gist.github.com/51337. If you run "ruby a.rb" you'll get something different than if your run "ruby b.rb", even though both are the result of "linking" a.rb and b.rb together. ...let's see you do that with C! ;-)
- bioengineer 18y agoIf I am understanding you correctly, I believe that it is possible in C, using macros. If you include the following in each file: #ifndef MAIN_ALREADY_DEFINED__ #define MAIN_ALREADY_DEFINED__ int main(){ /* file specific stuff */ } #endif Disclaimer: I wouldn't actually do this in practice...