On Thu, Apr 05, 2007 at 04:50:25AM +0900, Vinh C. wrote:
I think i’ll soon begin to learn programming in ruby, as so many people
find it ( and its buddy RoR ) awesome.
I’m a beginner programmer ( Basic, PHP, Caml, and i’m currently reading
some C/C++ tutorials )
That’s a pretty good beginning – three languages plus some dabbling.
Ruby is an interpreted language, if i’m not wrong, interpreted languages
are slightly slower than compiled ones,
so far i mainly coded web apps, but i may one day do some Desktop apps
programming, and so : are Ruby programs much slower/nearly as fast/ …
as a for example a C-compiled program ( i guess it depends a lot on the
kind of software ) ??
Technically, it’s not the language that’s slower – it’s the
implementation. It’s true that, all else being equal, intepreted code
runs more slowly than code compiled to a binary executable, but whether
it is interpreted or compiled depends on the implementation you’re
using. For instance, Objective Caml (aka OCaml) allows you to execute
code via an interpreter, to compile to bytecode and run in a VM, or to
compile to an executable binary file native to the platform.
Ruby, of course, is a rather more dynamic language than OCaml, and as
such is not (thus far) really suitable to compilation. As such, it is
executed via an interpreter, and it’s not a very fast interpreter. I’m
mostly just being pedantic here, but I figured I may as well make the
situation as crystal clear as is reasonable.
In any case, Ruby can definitely be used for desktop application
development. You just have to be sure you know where execution speed
will impose an unacceptable bottleneck, and perhaps choose a different
language in such circumstances. For instance, I don’t think I’d want
to implement a Mathematica clone entirely in Ruby, but a light weight
word processor or web browser should be fine.
About the possibilities of Ruby, i know Ruby is a generic language, and
that we can program almost every software in Ruby, but almost every
for example, is it possible to develop a peripheral driver in Ruby ??
more generally to access the hardware ? to write a linux kernel module
?? ( i guess it is not possible to write a ruby OS kernel )
I’d recommend against writing hardware drivers in Ruby, generally
speaking, though I imagine it’s possible. Writing an OS kernel might
prove a bit more difficult, with the interpreter-only implementation(s)
currently available. For that sort of thing, you probably want to stick
to something like C, OCaml, or maybe even Haskell or compiled Lisp.
Ruby (and even Perl) is a bit less practical for such purposes.