Things aren't just black and white. At the very least, they're also big and small, loud and quiet, blue and orange, grey and gray, long and short, right and wrong, etc.
Interpreted/compiled is just one way to categorize languages, and it's completely independent from (among countless other things) whether you call the same language a "scripting language" or not. To top it off, it's also a broken classification:
- Interpreted/compiled depends on the language implementation, not on the language (this is not just theory, there are indeed quite a few languages for which both interpreters and compilers exist)
- There are language implementations (lots of them, including most Ruby implementations) that are compilers, but "only" compile to bytecode and interpret that bytecode.
- There are also implementations that switch between interpreting and compiling to native code (JIT compilers).
You see, reality is a complex beast ;) Ruby is, as mentioned above, frequently compiled. The output of that compilation is then interpreted, at least in some cases - there are also implementations that JIT-compile (Rubinius, and IIRC JRuby compiles to Java bytecode after a while). The reference implementation has been a compiler for a long time, and IIRC still is. So is Ruby interpreted or compiled? Neither term is meaningful unless you define it ;)
But back to the question: "Scripting language" isn't a property of the language either, it depends on how the language is used - namely, whether the language is used for scripting tasks. If you're looking for a definition, the Wikipedia page on "Scripting language" may help (just don't let them confuse you with the notes on implementation details such as that scripts are usually interpreted). There are indeed a few programs that use Ruby for scripting tasks, and there are doubtless numerous free-standing Ruby programs that would likely qualify as scripts (web scraping, system administration, etc).
So yes, I guess one can call Ruby a scripting language. Of course that doesn't mean a ruby on rails web app is just a script.
Answer from user395760 on Stack OverflowThings aren't just black and white. At the very least, they're also big and small, loud and quiet, blue and orange, grey and gray, long and short, right and wrong, etc.
Interpreted/compiled is just one way to categorize languages, and it's completely independent from (among countless other things) whether you call the same language a "scripting language" or not. To top it off, it's also a broken classification:
- Interpreted/compiled depends on the language implementation, not on the language (this is not just theory, there are indeed quite a few languages for which both interpreters and compilers exist)
- There are language implementations (lots of them, including most Ruby implementations) that are compilers, but "only" compile to bytecode and interpret that bytecode.
- There are also implementations that switch between interpreting and compiling to native code (JIT compilers).
You see, reality is a complex beast ;) Ruby is, as mentioned above, frequently compiled. The output of that compilation is then interpreted, at least in some cases - there are also implementations that JIT-compile (Rubinius, and IIRC JRuby compiles to Java bytecode after a while). The reference implementation has been a compiler for a long time, and IIRC still is. So is Ruby interpreted or compiled? Neither term is meaningful unless you define it ;)
But back to the question: "Scripting language" isn't a property of the language either, it depends on how the language is used - namely, whether the language is used for scripting tasks. If you're looking for a definition, the Wikipedia page on "Scripting language" may help (just don't let them confuse you with the notes on implementation details such as that scripts are usually interpreted). There are indeed a few programs that use Ruby for scripting tasks, and there are doubtless numerous free-standing Ruby programs that would likely qualify as scripts (web scraping, system administration, etc).
So yes, I guess one can call Ruby a scripting language. Of course that doesn't mean a ruby on rails web app is just a script.
Yes.
Detailed response:
A scripting language is typically used to control applications that are often not written in this language. For example, shell scripts etc. can call arbitrary console applications.
Ruby is a general purpose dynamic language that is frequently used for scripting.
You can make arbitrary system calls using backtick notation like below.
`<system command>`
There are also many excellent Ruby gems such as Watir and RAutomation for automating web and native GUIs.
For definition of scripting language, see here.
0 How are Ruby and Java "interpreted" or "compiled" differently?
How strong is the market for Ruby developers?
Is Ruby a good first computing language?
Is a language itself compiled or interpreted?
Videos
I guess Ruby took off for many reasons:
- The Rails framework. Rails assembled together many useful patterns to ease the development of web applications and boosts developer's productivity. Compare this to Java's verbose and tedious web development and the "one man show" .NET platform. Creating weblog web applications in minutes was a jaw dropping.
You can see the "Rails effects" on many new JVM web frameworks like Grails, Play! and Spring Roo. - Success stories like Twitter and Github. Startups needs to hit the market as soon as possible and with Rails, this is possible. Success stories were an evidence.
- Ruby programming language itself is beautiful, powerful and expressive. IMHO, Ruby is the secret sauce of Rails success.
Look at the beauty of Cucumber and Sinatra, the beauty of DSLs done right. - Eager and brave community that isn't afraid to experiment and innovate.
- (Personal opinion and may not be vital reason) It is created in Japan. Nothing beats the image of "Made in Japan".
To me, learning programming languages created in different countries is the same as meeting new people. It is fun and educative.
Ruby/Japan, OCaml/France, Lua/Brazil, Lisp/Mars :)
This doesn't directly answer the title question, but addresses some points raised (i.e. why Ruby was created)
Quotes from Yukihiro 'Matz' Matsumoto, creator of Ruby, which may help explain what inspired its creation:
- "I wanted a scripting language that was more powerful than Perl, and more object-oriented than Python"
- "I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language."
So basically, Matz wanted an extremely object-oriented language that was designed for programmer happiness.
I guess this is something I have heard about as well, typed vs non-typed languages.
I notice in Ruby, that I can easily declare a String object by
str = "cool"
In Java I have to be more verbose:
String str = new String("cool");or a bit more shortened is allowed, for Strings at least, in Java,
String str = "cool";
How does one articulate what is going on here, does the compiler do the "work" and interpret and determine the object type based upon the value "cool" assigned to str variable in Ruby? Java requires us to declare the object type - String - upon instantiation of the String object. So I noticed the difference. Coming from a Ruby training background, learning some Java right now.