[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Some General Questions about Ruby

Vinh Chuc

4/4/2007 7:50:00 PM

Hi !
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 )

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 ) ??

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 )

thank you

( i'm not a native english speaker, sorry if any mistakes )

--
Posted via http://www.ruby-....

14 Answers

François Montel

4/4/2007 7:53:00 PM

0

Vinh Chuc wrote:

> 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 ) ??

Yes, Ruby is quite a bit slower than C. But depending on the program
you're writing, this may not make much/any difference to the end user.
If there are certain parts of the program that are creating a major
performance hit, you can always write those bits in C and then call your
C module from Ruby.


--
Posted via http://www.ruby-....

Chad Perrin

4/4/2007 8:22:00 PM

0

On Thu, Apr 05, 2007 at 04:50:25AM +0900, Vinh Chuc wrote:
> Hi !
> 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.

--
CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
Amazon.com interview candidate: "When C++ is your
hammer, everything starts to look like your thumb."

John Browning

4/4/2007 8:28:00 PM

0

Quick answers:

much slower, but for Web apps and a lot of other interactive apps
where input/output itself creates lots of delays and lots of waiting,
you probably don't care.

It's possible to do most or all of those things in Ruby -- apart from
the kernel module -- but you don't want to. One reason: an
interpreted language to execute has to bring with it the whole
interpreter, which makes it large. Second, which should probably be
first, speed matters much more in things like peripheral drivers
which lots of other programs use and thus can be chokepoints for the
whole system.

Ruby on Rails is slow even by the standards of Web applications. But
it's still well worth learning as it makes it much easier to develop
-- and more importantly to evolve -- powerful applications.

Good luck.


On 4 Apr 2007, at 20:50, Vinh Chuc wrote:

> Hi !
> 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 )
>
> 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 ) ??
>
> 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 )
>
> thank you
>
> ( i'm not a native english speaker, sorry if any mistakes )
>
> --
> Posted via http://www.ruby-....
>
>


Vinh Chuc

4/4/2007 9:30:00 PM

0

thanks !
@Chad Perrin
when i said i was a beginner programmer i meant in the desktop softwares
field ;), as so far i mainly coded in php, and maths algorithms with
caml

when i asked if it was possible to develop OS kernels/modules, i am
aware that "i don't want to", as it would imply that the kernel includes
the interpreter, that itself has a bunch of prerequisites
but from a theorical point of view, is it possible ? ( can ruby deal
with hardware access, memory management etc ... )




I have another question, about the WxRuby toolkit, i never used a gui
toolkit before, but i guess it works like that :
_ for a compiled program ( for example C/C++ ), the toolkit library, is
either already installed on the end user computer, either it is
"included" in the source code and compiled with it
_ but for an interpreted language, how does it work ??? do the end user
have to install a specific wxwidgets library ? or does wxruby provide a
file that we have to bundle with the .rb files ????

thanks again

--
Posted via http://www.ruby-....

Brian Candler

4/4/2007 9:30:00 PM

0

On Thu, Apr 05, 2007 at 05:22:00AM +0900, Chad Perrin wrote:
> > 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.

Although there are specific places where userland programs are intended to
hook into the kernel, and Ruby is fine for such things. For example, using
ruby fusefs you can write your own filesystem in Ruby.
http://rubyforge.org/projec...

Chad Perrin

4/4/2007 10:23:00 PM

0

On Thu, Apr 05, 2007 at 06:29:43AM +0900, Brian Candler wrote:
> On Thu, Apr 05, 2007 at 05:22:00AM +0900, Chad Perrin wrote:
> > > 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.
>
> Although there are specific places where userland programs are intended to
> hook into the kernel, and Ruby is fine for such things. For example, using
> ruby fusefs you can write your own filesystem in Ruby.
> http://rubyforge.org/projec...

Agreed. I didn't mean to suggest that you shouldn't interact with the
kernel with Ruby -- just that it's usually not the best language for
interacting directly with hardware and writing low-level stuff like
most Linux kernel modules (for instance).

--
CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
"The first rule of magic is simple. Don't waste your time waving your
hands and hopping when a rock or a club will do." - McCloctnick the Lucid

Vinh Chuc

4/5/2007 2:29:00 PM

0

ok, thanks, i know that ruby is not aimed at developing kernel related
programs, it was just to know if it was theorically possible
bye !

--
Posted via http://www.ruby-....

The PHANTOM

4/20/2011 11:21:00 AM

0

On Apr 19, 11:25 pm, Franklin Hummel <franklin.hum...@gmail.com>
wrote:
> It's a sign of a truly pathetic poster when they have to repost their
> own post -- because no one fucking care about what they have to say
> the first time.

But,you responded.

Tracey12

4/20/2011 11:32:00 AM

0

On Apr 19, 11:25 pm, Franklin Hummel <franklin.hum...@gmail.com>
wrote:
> It's a sign of a truly pathetic poster when they have to repost their
> own post -- because no one fucking care about what they have to say
> the first time.

Hello Mr Nobody. Thanks for your comment.

Tracey12

4/20/2011 11:38:00 AM

0

On Apr 19, 11:25 pm, Franklin Hummel <franklin.hum...@gmail.com>
wrote:

> It's a sign of a truly pathetic poster when they have to repost their
> own post -- because no one fucking care about what they have to say
> the first time.

Hello Mr Nobody. Thanks for your comment.