Why Ruby over Python?

I'm just curious; where does Haskell fit in this? I think in this
taxonomy it might fall under "lisp" because of the broad "functional"
language category, but I've found that doing serious stuff in Haskell
stretches my mind more than the bits of common lisp I've learned (but
that's probably because I have never gotten heavily into CL macros).

Haskell is a strict, lazy functional language (and pretty close to the
state-of-the-art in computer languages, IMHO). As such it neatly fits the
Lisp category.

(those business analysts who are looking at this and thinking of right

now mandating python use for everything are well advised to go
(re-)read the book "Peopleware", and realize that developers having
"fun" has very serious economic advantages)

I haven't met anyone working for a large or reasonably-large company
who is thinking of mandating anything but Java. Python is generally
considered highly suspect and Ruby isn't on the radar at all. Ajax is seen
by many as a dangerous and subversive practice that must not be allowed to
take root. If you have examples to the contrary, I'd be really interested to
hear them.

If you follow the framework debates in the Java world, they've been talking
for months now about how heavyweight frameworks (which are still being
invented every other day, it seems) may be dying because of Ajax (read,
because of Rails). This obviously scares the hell out of people who have
invested heavily in Struts, Faces, and similar stuff.

···

On 7/9/06, Daniel Martin <martin@snowplow.org> wrote:

You can use Wx, Qt, Fox, and a variety of other standard GUI toolkits
that are used in other programming languages. There's even non-standard
ones such as http://www.widestudio.org. Tk is primitive and just more
of a starter option in my eyes, but it goes allow a newbie to get their
feet under them. Past that there are plenty of other GUI toolkits as
you will find out...

Marcelo wrote:

···

Oh, yes, I saw that page, but for what I saw, most of them are in early
development or dead. The only one apparently working is the Ruby/Gnome.

Am I wrong? Who is doing GUI development in Ruby and what are they
using? (please, Tk is awful both in Ruby and Python) I think that in
GUI development, Ruby is far behind Python, and that is something that
keeps me from stepping into Ruby.

Any help would be appreciated, and sorry for my English.

Marcelo

Marcelo wrote:

Oh, yes, I saw that page, but for what I saw, most of them are in early
development or dead. The only one apparently working is the Ruby/Gnome.

The most mature and the most feature-rich is FXRuby. I wrote my master degree using it. It was quite complex application using opengl and swig interfacing with c++. I had some minor problems with it. As can be seen from wxruby homepage, it is also under active development.

lopex

Oh, yes, I saw that page, but for what I saw, most of them are in early
development or dead. The only one apparently working is the Ruby/Gnome.

Then you've gotten some bad information. FXRuby is a little over five
years old, and FOX (the GUI toolkit it's based on) is at least eight
years old. Both FOX and FXRuby are being actively developed, with a
new major release in the last few months.

You mentioned Ruby/GNOME. There's also the Ruby/Qt bindings, which I
understand to be very good, and wxRuby seems to be coming along very
well.

Am I wrong? Who is doing GUI development in Ruby and what are they
using? (please, Tk is awful both in Ruby and Python) I think that in
GUI development, Ruby is far behind Python, and that is something that
keeps me from stepping into Ruby.

I don't think there's one GUI toolkit that dominates the field. Other
than Ruby/Tk, I get the impression that the "big three" right now are
Ruby/GNOME, Ruby/Qt and FXRuby.

···

On 7/10/06, Marcelo <barberomarcelo@gmail.com> wrote:

You really caught me with that Ruby Haiku concept. I started working on it, but the last line is really tricky to get up to five syllables and still be meaningful. It's an odd downside to ruby's terse syntax.

Maybe I'll put a page for ruby Haiku on http://wiki.rubygarden.org/Ruby/page/show/RubyFun once I come up with something :slight_smile:
-Mat

···

On Jul 10, 2006, at 3:45 PM, Tim Pease wrote:

PS We should have an official "Thank Matz" day. Send him money, or
an Apple iCard, or write a Ruby program that is a haiku and actually
parses and runs -- hmmm ... Ruby Haiku day for Matz

> Doug H wrote:
> > > Besides ROR, can you give me a reason why perfer ruby instead
> > > of python?
> > >
> > > seems to many users, they are very similar in nature...
> > >
> > > such as
> > >
> > > 1. non C or Java style syntax
> > > 2. focus on codes readability, not like Perl
> > > 3. ..
> >
> > Go ask this same question over on comp.lang.python and you'll see
> > why you might prefer ruby.
>
> Funny you ask:
> http://groups.google.ca/group/comp.lang.python/tree/browse_frm/thre
>ad/40d8d11e12cb00ba/12306d4d9b0ce50c?rnum=11&q=ruby+or+python&_done=
>%2Fgroup%2Fcomp.lang.python%2Fbrowse_frm%2Fthread%2F40d8d11e12cb00ba
>%2F7256adbbc7f79afe%3Fq%3Druby+or+python%26rnum%3D1%26#doc_74bfb0743
>eff1367

Interesting. Someone there said that Python is more like Java
and Ruby is more like Smalltalk. I've never written any
Smalltalk, but I know some Lisp. IMO, Ruby and Python are both
somewhere between Lisp and Java, Python closer to Java, Ruby
closer to Lisp.

I have learned many programming languages in the last two years
and the ones I like most are Ruby, Lisp and Haskell. There is one
thing these three languages have in common: It's easy and natural
to construct domain specific languages in them, allowing you
to write code that expresses more directly the problem at hand.

Consider Rake/Rant syntax:

    task :a do
      ...
    end

    task :b => :a do
      ...
    end

I haven't done much with Rake yet, but fortunately I knew that => is
used to indicate that one task depends on another. I wonder how many
people who didn't know Rake would guess that.

Or a well known (in the Haskell community) DSL in Haskell
is Parsec; an example from the Haskell wiki:

    parseInput = do
        dirs <- many dirAndSize
        eof
        return dirs

    data Dir = Dir {dir_size::Integer, dir_name::String} deriving Show

    dirAndSize = do
        size <- many1 digit
        spaces
        dir_name <- anyChar `manyTill` newline
        return (Dir (read size) dir_name)

And this? I don't know Haskell, but I thought if it's a good language
for creating DSLs then I'd at least have a good guess at what the code
does. Unfortunately I don't have a guess here. I think that's a bad
sign. Call me stupid if you'd like.

Of course, Lisp is *the* language for DSL construction.

I'd like to see a DSL example in LISP.

···

On 7/11/06, Stefan Lang <langstefan@gmx.at> wrote:

On Tuesday 11 July 2006 17:00, jmdeschamps@gmail.com wrote:
> > howachen@gmail.com wrote:

Python, and more so Java do not allow you to construct a DSL.
Thus in Python and Java, on the syntax level you are always
limited to the few constructs the language provides: Defining
classes and methods, constructing objects, calling methods,
arithmetic expressions, branches via if/else, switch/case.
This gets more limiting the bigger a project grows. Java people
compensate this via huge frameworks that interpret XML files.

Ruby's design is also more coherent than Python's. One example
where Python really f****d up are properties. Python's properties
are an ugly mess, just IMO.

If you already know Java/C#/C++, you'll gain much more in
learning Ruby than Python.

--
Stefan

--
R. Mark Volkmann
Object Computing, Inc.

Stefan Lang wrote:

Interesting. Someone there said that Python is more like Java
and Ruby is more like Smalltalk. I've never written any
Smalltalk, but I know some Lisp. IMO, Ruby and Python are both
somewhere between Lisp and Java, Python closer to Java, Ruby
closer to Lisp.

Ultimate object orientation, continuations and blocks/closures - the last is very very smalltalkish ;D

Smalltalk at: #a put: (Array new: 2)!
a at: 1 put: 'some string'.
a at: 2 put: 'some other string'.
a do: [:n| n printNl].

a=
a << 'some string'
a << 'some other string'
a.each{|n| n.display}

The similarity is obvious.

lopex

Francis Cianfrocca wrote:

I haven't met anyone working for a large or reasonably-large company
who is thinking of mandating anything but Java. Python is generally
considered highly suspect and Ruby isn't on the radar at all. Ajax is
seen
by many as a dangerous and subversive practice that must not be
allowed to
take root. If you have examples to the contrary, I'd be really
interested to
hear them.

Well, I rather suspect .NET has reached the point that it's
"mandatable", like all other Microsoft products. On the other hand, the
whole point of Java is, or at least was, to be server and desktop
platform independent. Whether it's worked out that way is a question I
can't answer.

If you follow the framework debates in the Java world, they've been
talking
for months now about how heavyweight frameworks (which are still being
invented every other day, it seems) may be dying because of Ajax (read,
because of Rails). This obviously scares the hell out of people who have
invested heavily in Struts, Faces, and similar stuff.

Has anyone really determined once and for all whether the dinosaurs died
out because they were too large for their environment or because a huge
hunk of rock hit the Yucutan Peninsula? :slight_smile:

···

--
M. Edward (Ed) Borasky

http://linuxcapacityplanning.com

Francis Cianfrocca wrote:

I haven't met anyone working for a large or reasonably-large company
who is thinking of mandating anything but Java. Python is generally
considered highly suspect and Ruby isn't on the radar at all. Ajax is seen
by many as a dangerous and subversive practice that must not be allowed to
take root. If you have examples to the contrary, I'd be really interested to
hear them.

Google? (Python and AJAX)

···

--
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

"Francis Cianfrocca" <garbagecat10@gmail.com> writes:

···

On 7/9/06, Daniel Martin <martin@snowplow.org> wrote:

I'm just curious; where does Haskell fit in this? I think in this
taxonomy it might fall under "lisp" because of the broad "functional"
language category, but I've found that doing serious stuff in Haskell
stretches my mind more than the bits of common lisp I've learned (but
that's probably because I have never gotten heavily into CL macros).

Haskell is a strict, lazy functional language (and pretty close to the
state-of-the-art in computer languages, IMHO). As such it neatly fits the
Lisp category.

Except just about all Lisps are dynamically-typed, not lazy and not
side-effect free either... Haskell would make a good addition to the
taxonomy on itself.

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

Boeing's recognized that Python has significant advantages over Java
for some things. The company certainly isn't mandating Java.

Joe

···

On 7/9/06, Francis Cianfrocca <garbagecat10@gmail.com> wrote:

On 7/9/06, Daniel Martin <martin@snowplow.org> wrote:
>
> I'm just curious; where does Haskell fit in this? I think in this
> taxonomy it might fall under "lisp" because of the broad "functional"
> language category, but I've found that doing serious stuff in Haskell
> stretches my mind more than the bits of common lisp I've learned (but
> that's probably because I have never gotten heavily into CL macros).

Haskell is a strict, lazy functional language (and pretty close to the
state-of-the-art in computer languages, IMHO). As such it neatly fits the
Lisp category.

(those business analysts who are looking at this and thinking of right
> now mandating python use for everything are well advised to go
> (re-)read the book "Peopleware", and realize that developers having
> "fun" has very serious economic advantages)
>
I haven't met anyone working for a large or reasonably-large company
who is thinking of mandating anything but Java. Python is generally
considered highly suspect and Ruby isn't on the radar at all. Ajax is seen
by many as a dangerous and subversive practice that must not be allowed to
take root. If you have examples to the contrary, I'd be really interested to
hear them.

What I wanted to know with my previous post was what are rubyist using
IN PRACTICE NOW. That's to say, what are the GUI toolkits more used
(except Tk)

gregarican wrote:

···

You can use Wx, Qt, Fox, and a variety of other standard GUI toolkits
that are used in other programming languages. There's even non-standard
ones such as http://www.widestudio.org. Tk is primitive and just more
of a starter option in my eyes, but it goes allow a newbie to get their
feet under them. Past that there are plenty of other GUI toolkits as
you will find out...

Marcelo wrote:
> Oh, yes, I saw that page, but for what I saw, most of them are in early
> development or dead. The only one apparently working is the Ruby/Gnome.
>
> Am I wrong? Who is doing GUI development in Ruby and what are they
> using? (please, Tk is awful both in Ruby and Python) I think that in
> GUI development, Ruby is far behind Python, and that is something that
> keeps me from stepping into Ruby.
>
> Any help would be appreciated, and sorry for my English.
>
> Marcelo

Marcin Mielżyński wrote:

Marcelo wrote:

Oh, yes, I saw that page, but for what I saw, most of them are in early
development or dead. The only one apparently working is the Ruby/Gnome.

The most mature and the most feature-rich is FXRuby. I wrote my master
degree using it. It was quite complex application using opengl and
swig interfacing with c++. I had some minor problems with it. As can
be seen from wxruby homepage, it is also under active development.

And if having a well-written tutorial matters, check out the Pragmatic
Programmers' book on QTRuby (with additional info on Korundum and
Kommander).

···

--
M. Edward (Ed) Borasky

http://linuxcapacityplanning.com

I would LOVE wxRuby when it is done.

This is the last state, from SourceForge:

Development Status: 4 - Beta
wxRuby 0.6.0 November 21, 2004

Not as near as wxPython 2.6.3.

It's a shame.

Marcin Mielzynski wrote:

···

Marcelo wrote:
> Oh, yes, I saw that page, but for what I saw, most of them are in early
> development or dead. The only one apparently working is the Ruby/Gnome.
>

The most mature and the most feature-rich is FXRuby. I wrote my master
degree using it. It was quite complex application using opengl and swig
interfacing with c++. I had some minor problems with it. As can be seen
from wxruby homepage, it is also under active development.

lopex

harp:~ > cat a.rb

     raise :the, :red_flag unless :weak

   throw :fear while :people and not :truth

     :dove and :hawk while :death

   harp:~ > ruby a.rb
   (infinite loop on last line)

-a

···

On Tue, 11 Jul 2006, Mat Schaffer wrote:

On Jul 10, 2006, at 3:45 PM, Tim Pease wrote:

PS We should have an official "Thank Matz" day. Send him money, or
an Apple iCard, or write a Ruby program that is a haiku and actually
parses and runs -- hmmm ... Ruby Haiku day for Matz

You really caught me with that Ruby Haiku concept. I started working on it,
but the last line is really tricky to get up to five syllables and still be
meaningful. It's an odd downside to ruby's terse syntax.

Maybe I'll put a page for ruby Haiku on http://wiki.rubygarden.org/ Ruby/page/show/RubyFun once I come up with something :slight_smile:

--
suffering increases your inner strength. also, the wishing for suffering
makes the suffering disappear.
- h.h. the 14th dali lama

[...]

> I have learned many programming languages in the last two years
> and the ones I like most are Ruby, Lisp and Haskell. There is one
> thing these three languages have in common: It's easy and natural
> to construct domain specific languages in them, allowing you
> to write code that expresses more directly the problem at hand.
>
> Consider Rake/Rant syntax:
>
> task :a do
> ...
> end
>
> task :b => :a do
> ...
> end

I haven't done much with Rake yet, but fortunately I knew that =>
is used to indicate that one task depends on another. I wonder how
many people who didn't know Rake would guess that.

You have to learn *any* syntax/API. Important is that it's
easy to remember and that you don't have to write unnecessary
code each time you define a task. In Python this would
probably be done like this:

    def fun_a():
      ...

    task("a", fun_a)

    def fun_b():
      ...

    task("b", "a", fun_b)

Having to define the separate functions fun_a and fun_b
is an unnecessary burden for the programmer. Having to
invent those function names gets tiresome. And I don't
see how that would be any clearer than the Ruby version.

> Or a well known (in the Haskell community) DSL in Haskell
> is Parsec; an example from the Haskell wiki:
>
> parseInput = do
> dirs <- many dirAndSize
> eof
> return dirs
>
> data Dir = Dir {dir_size::Integer, dir_name::String} deriving
> Show
>
> dirAndSize = do
> size <- many1 digit
> spaces
> dir_name <- anyChar `manyTill` newline
> return (Dir (read size) dir_name)

And this? I don't know Haskell, but I thought if it's a good
language for creating DSLs then I'd at least have a good guess at
what the code does. Unfortunately I don't have a guess here. I
think that's a bad sign. Call me stupid if you'd like.

Perhaps it wasn't so a good idea to drop these examples
in without any explanation :frowning:

The parseInput function parses lines like this:

  65572 /home/adept/photos/raw-to-burn/dir1

This example is from
http://haskell.org/haskellwiki/Hitchhikers_Guide_to_the_Haskell

The important point here is again that if you know basic
Haskell, Parsec provides an easy way to define parsers.
There is no bookkeeping for the Haskell compiler.
Parsec was used for Pugs, the first Perl 6 compiler. So
it seems to work for harder tasks too.

> Of course, Lisp is *the* language for DSL construction.

I'd like to see a DSL example in LISP.

Taken from "Practical Common Lisp",
http://www.gigamonkeys.com/book/practical-building-a-unit-test-framework.html

Usage of a small unit test framework:

    ;; Define a test case for the "+" function
    (deftest test-+ ()
      (check
        (= (+ 1 2) 3)
        (= (+ 1 2 3) 6)
        (= (+ -1 -3) -4)))

    ;; Another test case for "*"
    (deftest test-* ()
      (check
        (= (* 2 2) 4)
        (= (* 3 5) 15)))

    ;; Test suite for arithmetic functions
    (deftest test-arithmetic ()
      (combine-results
        (test-+)
        (test-*)))

    ;; run the test suite
    (test-arithmetic)
    pass ... (TEST-ARITHMETIC TEST-+): (= (+ 1 2) 3)
    pass ... (TEST-ARITHMETIC TEST-+): (= (+ 1 2 3) 6)
    pass ... (TEST-ARITHMETIC TEST-+): (= (+ -1 -3) -4)
    pass ... (TEST-ARITHMETIC TEST-*): (= (* 2 2) 4)
    pass ... (TEST-ARITHMETIC TEST-*): (= (* 3 5) 15)
    T

That "T" in the last lines means that all tests have passsed.
"deftest", "check" and "combine-results" are user defined macros.
The whole "framework" is defined in 26 lines of code.
For my needs, I would tweak it so that the test code is printed
only for tests that failed.

Currently I have to write a Java webapp at work. Writing Java and
loads of XML when you know Lisp and Ruby really hurts.
If Java would provide something like Lisp's macros or some of
Ruby's features (anonymous closures, defining own attr_* methods,
higher order functions, etc.), I'm sure we could reduce the code
size of the project to a quarter or less of the current size.
The same goes for the XML code. Those XML DSLs have a serious
problem. When a certain pattern occurs often in the project and
the framework hasn't a builtin way to factor it out, you're out
of luck. Type it out each time.

In an Rantfile/Rakefile I have the full power of Ruby at hand.
I simply Won't Repeat Myself.

···

On Tuesday 11 July 2006 23:50, Mark Volkmann wrote:

On 7/11/06, Stefan Lang <langstefan@gmx.at> wrote:

--
Stefan

Joel VanderWerf wrote:

... Google? (Python and AJAX)

Microsoft has been using AJAX since 1998 or so.

Not so much Java. :slight_smile:

···

--
James Britt

GOOG isn't a big company ;-).
MSFT is, though. But they don't really count for this discussion because
they have a dog in the fight.

···

On 7/9/06, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:

Francis Cianfrocca wrote:
> I haven't met anyone working for a large or reasonably-large company
> who is thinking of mandating anything but Java. Python is generally
> considered highly suspect and Ruby isn't on the radar at all. Ajax is
seen
> by many as a dangerous and subversive practice that must not be allowed
to
> take root. If you have examples to the contrary, I'd be really
> interested to
> hear them.

Google? (Python and AJAX)

--
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Except just about all Lisps are dynamically-typed, not lazy and not
side-effect free either... Haskell would make a good addition to the
taxonomy on itself.--

Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

I guess you could say that. I used to write compilers for a living, so
perhaps my perspective is different. To me the essential trait that
distiguishes the Lisp-like family is that they're all based on
lambda-calculus. Everything Algol-like (including Ruby) is basically a
Turing machine. SQL and similar languages are off to the side, and Fortran I
guess would have to be classed as Turing-like. We're way off thread here, so
if you want to have the last word, be my guest ;-).

Comcast is laying some serious AJAX groundwork these days. We still do a lot of Java, but I've done Ruby for smaller projects already.
-Mat

···

On 7/9/06, Francis Cianfrocca <garbagecat10@gmail.com> wrote:

I haven't met anyone working for a large or reasonably-large company
who is thinking of mandating anything but Java. Python is generally
considered highly suspect and Ruby isn't on the radar at all. Ajax is seen
by many as a dangerous and subversive practice that must not be allowed to
take root. If you have examples to the contrary, I'd be really interested to
hear them.