Ruby advantages over Perl

Um…I think you’ll find everybody here is fully inoculated against
trolls…except me…

Go speak latin; it’s more ‘stimulating’

Anubis wrote:

OO Programming is not the Panacee and I don’t like Ruby because my mind is

···

much less stimulated programming with it.
I mean if you have to “turn right and become red” then Ruby has already a
method doing that.
And you can use it like this : Object.turn_right_become_red
I prefer doing that by programming instead of writing something which
someone has already programmed for me. Because people saying that since they
program with Ruby they don’t want to program with another language are true
: they are not adapted anymore with popular but harder programming language.
I mean you have to train your brain and not to become lazy with it. That’s
why after programming a little bit with Ruby and with Perl I choose Perl.
Perl brings fun to programming also because you have to think. If “fun”
means to you playing video games instead of chess then Ruby is for you and
you will find a lot of obvious advantages of Ruby over Perl…

Anubis

“Marek Janukowicz” childNOSPAM@t17.ds.pwr.wroc.pl a écrit dans le message
news: slrnbefclg.6r9.childNOSPAM@child.t9.ds.pwr.wroc.pl…

I am going to write an article to a software magazine titled “Ruby as an
alternative to Perl”. There are some obvious advantages of Ruby over
Perl:

  • Ruby is fully object oriented
  • blocks
  • introspection
  • very little difference between compile time and runtime

Could you give me some more clues (I am missing a lot for sure)?

TIA

Marek Janukowicz

LOL. You would probably really like assembler. Seems your mind finds
doing things the hard way stimulating. I spent my first five years with
mainframe assembler. Great puzzle. But I found that stimulating
rapidly turned into tedious. Programming at a higher level, such as
OOP, put the stimulation back. I have yet to explore the depths of OOP,
even after many years.

···

On Thu, 12 Jun 2003 21:21:20 +0900 “Anubis” philippe.deschamps@sympatico.ca wrote:

OO Programming is not the Panacee and I don’t like Ruby because my
mind is much less stimulated programming with it.

I like video games and chess, but probably chess more.

I like Perl and Ruby, but definitely Ruby more!

I just defeated a chess program written in 1982 for C64. I won a
bishop in the middlegame, but at the cost of a couple of pawns, and it
was touch and go in the endgame. (Sigh, I thought I’d slaughter
it…)

Cheers,
Gavin

···

On Thursday, June 12, 2003, 10:21:20 PM, Anubis wrote:

If “fun” means to you playing video games instead of chess then Ruby
is for you and you will find a lot of obvious advantages of Ruby
over Perl…

OO Programming is not the Panacee and I don’t like Ruby because my mind is
much less stimulated programming with it.
I mean if you have to “turn right and become red” then Ruby has already a
method doing that.
And you can use it like this : Object.turn_right_become_red

Ok, let’s pretend that’s true for the sake of argument.
I’m not the language police, write VBScript if you want.
That said:

I prefer doing that by programming instead of writing something which
someone has already programmed for me. Because people saying that since they
program with Ruby they don’t want to program with another language are true
: they are not adapted anymore with popular but harder programming language.

Yeah, like assembler or C.
Don’t ‘#include <stdio.h>’ though, you should write your own functions to
access disk sectors manually. Otherwise where’s the fun?

I am mortal. I have a finite lifespan.
Life is too short to piss about with low-level languages.

When I want to drink cranberry juice, I buy a carton. I don’t genetically
engineer cranberries to grow in Wales awful climate,
wait 10 years and then squeeze them individually by hand.

Plus I think your argument is flawed.
Take Array.each as an example. I don’t see how that is any less l33+
than a for loop, it just looks nicer, and saves my RSI from getting
worse.

The fun is in writing applications, not grovelling around rewriting a
function to walk down an array for the umpteenth time.

···


Rasputin :: Jack of All Trades - Master of Nuns

What a great compliment for Ruby! But, why do you read this group if you
dropped Ruby?

robert

“Anubis” philippe.deschamps@sympatico.ca schrieb im Newsbeitrag
news:n0_Fa.4855$JN6.818060@news20.bellglobal.com

OO Programming is not the Panacee and I don’t like Ruby because my mind
is
much less stimulated programming with it.
I mean if you have to “turn right and become red” then Ruby has already
a
method doing that.
And you can use it like this : Object.turn_right_become_red
I prefer doing that by programming instead of writing something which
someone has already programmed for me. Because people saying that since
they
program with Ruby they don’t want to program with another language are
true
: they are not adapted anymore with popular but harder programming
language.
I mean you have to train your brain and not to become lazy with it.
That’s
why after programming a little bit with Ruby and with Perl I choose
Perl.
Perl brings fun to programming also because you have to think. If “fun”
means to you playing video games instead of chess then Ruby is for you
and

···

you will find a lot of obvious advantages of Ruby over Perl…

Anubis

i understand what you are saying. i also enjoy programming in perl for those
same reasons. but, to make an analogy, perl is like a swiss army knife and
fine for doing little wood carvings - you can become very involved in some
intracate little detail and that i find very enjoyable. however, ruby is like
a pickup truck full of powertools (i used to be a contractor btw.) and, if you
are building a house, infinitely more powerful. i suppose this analogy is
true of any procedural vs. oo language. oo programming is absolutely not
the panacee people claim is it - i don’t see complex inheritence heirarchies
as elegant design, i see them as tightly coupled balls of string: all of
meyer’s books are, IMHO, incredible arguements against oo programming in
general and c++ in particular. ruby, however, hits the nail right on the
head: it’s oo model is like a power drill or skill saw - ultra utilitarian:
faster, and easier. because i do also enjoy those ‘chess’ aspects of
programming i look forward to any chance to write a c extension for ruby. in
fact, i don’t even really write c++ anymore, i write c and then wrap it in
c++, much as a ruby extension works. so, by designing overall systems in
ruby, but addressing some of the finer details in c, i get the best of both
worlds from both the programming enjoyment, and quality of product,
perspectives.

my 2 cents.

-a

···

On Thu, 12 Jun 2003, Anubis wrote:

OO Programming is not the Panacee and I don’t like Ruby because my mind is
much less stimulated programming with it. I mean if you have to “turn right
and become red” then Ruby has already a method doing that. And you can use
it like this : Object.turn_right_become_red I prefer doing that by
programming instead of writing something which someone has already
programmed for me. Because people saying that since they program with Ruby
they don’t want to program with another language are true : they are not
adapted anymore with popular but harder programming language. I mean you
have to train your brain and not to become lazy with it. That’s why after
programming a little bit with Ruby and with Perl I choose Perl. Perl brings
fun to programming also because you have to think. If “fun” means to you
playing video games instead of chess then Ruby is for you and you will find
a lot of obvious advantages of Ruby over Perl…

Anubis

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
~ > ruby -e ‘p(%.\x2d\x29..intern)’
====================================

To which I say “thank goodness!”. CPAN is, IMO, a bad model: It’s only for perl stuff. We don’t need to reinvent CPAN for Ruby: What we really need is a package manager flexible enough so that we can just do a:

~$ ultimate_package_manager --add-source http://www.ruby-lang.org/raa
~$ ultimate_package_manager --install raa/testunit

…or whatever. We need more flexible package managers in general, not just a language specific package manager every time we feel like we need to reinvent the wheel.

Jason Creighton

···

On Thu, 12 Jun 2003 17:56:02 +0900 Armin Roehrl armin@xss.de wrote:

I am going to write an article to a software magazine titled “Ruby as an
alternative to Perl”. There are some obvious advantages of Ruby over
Perl:
the 1st thoughts that spring to my mind

pro:

  • Ruby code is easier to read. Readability facilitates communication.
    (more elegant)
  • friendly community; Perl has become too big.

contra:

  • RAA has a long way to go before it becomes CPAN

So perl is better because it’s harder and you have to think more? I doubt
any perl advocates would want you to use this argument on their side in
this one… :wink:

The way I look at it is that Ruby helps me by taking care of the details of
writing a program and lets me worry about solving the problem.

···

On Jun 12, Anubis wrote:

OO Programming is not the Panacee and I don’t like Ruby because my mind is
much less stimulated programming with it.
I mean if you have to “turn right and become red” then Ruby has already a
method doing that.
And you can use it like this : Object.turn_right_become_red
I prefer doing that by programming instead of writing something which
someone has already programmed for me. Because people saying that since they
program with Ruby they don’t want to program with another language are true
: they are not adapted anymore with popular but harder programming language.
I mean you have to train your brain and not to become lazy with it. That’s
why after programming a little bit with Ruby and with Perl I choose Perl.
Perl brings fun to programming also because you have to think. If “fun”
means to you playing video games instead of chess then Ruby is for you and
you will find a lot of obvious advantages of Ruby over Perl…

That because Perl mixes strings and numbers, isn’t it?
But is the following possible?

item = Object.new # replace by something meaningful
prices[item] = 20

···

On Thu, Jun 12, 2003 at 11:06:55AM +0900, Michael Campbell wrote:

  1. any type of object can be used as a key in a Ruby hash (Perl can
    only use strings as keys).

I don’t think this is accurate. This works perfectly fine in perl:

$hash{1.0} = “foo”;
keys %hash # => “1” or 1, depending on context.


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Never trust an operating system you don’t have sources for. :wink:
– Unknown source

In article 20030612022421.GZ22846@ouroboros.anu.edu.au,

[…]

  1. Built-in types like Array seem to have more methods that work on them
    than Perl’s. ie. you can do this out of the box in Ruby, but I don’t
    think you can in Perl:

a = [‘a’,‘b’,‘c’,‘d’,‘e’]
b = a - [‘c’]
#b => [“a”, “b”, “d”, “e”]

There’s no operator overloading of this sort, no. Of course,
this particular task could be viewed as a convenient façade
to the find and reject methods, which perl has as the grep
function.

@b = grep { $_ != 4 } @a;
b = a.reject { |e| e == 4 }

I didn’t mean to imply it was impossible in Perl, but it’s much easier and
more convenient in Ruby.

[…]

  1. any type of object can be used as a key in a Ruby hash (Perl can
    only use strings as keys).

Although it should be noted that references will be happily
stringified if used as keys and that there is a core module
Tie::RefHash that lets you use ‘real’ references as keys.

[…]

Fair enough.

  1. yield and code blocks

These are trivial to implement, you just end up with a few
more keywords.

I’m a bit skeptical that it would be trivial to implement yield in Perl.
…not saying it would be impossible to implement, but I’m thinking it
wouldn’t be trivial.

Basically, the main difference I usually see between Perl
and Ruby is that Ruby just gives you less ‘noise’. Take away
various characters from a Perl program and you approach the
Ruby one. Start restructuring your code to be more Rubyish,
you lose even more.

You can do anything in Perl that you can in Ruby, it’s just
that some things may require you to pull in a module or
write a few more characters.

True. Languages influence how we think about problems, and while you can
program in a Perlish way in Ruby (a lot of us started out that way :wink:
it’s probably more difficult (or it doesn’t occur to the Perl programmer)
to program in a Rubyish way in Perl.

Phil

···

Iain Truskett spoon@dellah.org wrote:

Yes, I agree. I think it’s best to give some code examples. This is what
I’d suggest.

Example 1:

Factorial.

class Fixnum
def !
self < 0 and raise “Factorial only defined for non-negative numbers”
self == 0 and return 1
self * (self - 1).
!
end
end

Wehn presenting a new language, I would shy away from statements that (I’m
having a hard time wording this) don’t directly convey meaning. Ie.

self < 0 and raise "Factorial only defined for non-negative numbers"
self ==1 and return 1

Particularly the second statement, as it could easily be mistaken for an
assignment. I would prefer:

raise "Factorial only defined for non-negative numbers" if self < 0
return 1 if self == 1

I’ve never cared for the ‘foo and bar’ ‘foo or bar’, as I always have to
think them through (“okay, if self is less than zero, it will return true,
meaning the second part of the statement will be evaluated.” In the case of
“or”: “okay, if whatever is greater than that constant, it will return true,
and the rest of the statement won’t have to be evaluated, so if that’s true,
don’t do that”)

Probably a deficiency in the Boolean section of my brain. Of course Perl
people will eat it up, since they like to:
(foo == bar) && foo = bar
and the like.

Just some ramblings.

···

on 6/11/03 11:28 PM, Daniel Carrera at dcarrera@math.umd.edu wrote:


Regards,
JJ

Be Kind, Be Careful, Be Yourself

ps. Off to work, no time for spell check.

“Mauricio Fernández” batsman.geo@yahoo.com wrote in message

I guess you meant that Ruby has no native threads but rather green
threads, etc…

I must be using wrong terminology here … I meant to say OS independant.
I thought “native” meant language supported … but looks like it means OS
supported. Thanks for correcting me. What is the correct term for language
supported threading ? “Simulated threading” ? Is “green threads” a technical
term?

But I’m not sure this would be perceived as an advantage: some people
don’t care about threads working in DOS or portability.

I can understand why people don’t care for threading on DOS. But portability
?
Isn’t that an advantage ? Unless, of course, you mean portability compared
to
lack of “native” threading.

I really love plurality…(to hide myself in a minority =)

Why are we always trying to convince people about ruby capabilities ?..

Here at work there are some guys writing perl,php,c code …
I tried to convince them about ruby capabilities, I got tired
I became more productive…and now they are writing code and training
‘their brains’ and I am writing this mail(after 1 hour reading).

“Perl brings fun to programming”.sub(“to”,“to ruby”)

=)

Re: Ruby disadvantages over Mind & Ruby Advantages over Perl
Yes you are right ruby sucks…

Rasputin wrote: (I will keep it in my favorite phrases )
Life is too short to piss about with low-level languages… and low-level guys !

Enjoy life.

def something_better_to_do
perl hardwork.pl
end

-r.

Robert Klemme wrote:

···

What a great compliment for Ruby! But, why do you read this group if you
dropped Ruby?

robert

“Anubis” philippe.deschamps@sympatico.ca schrieb im Newsbeitrag
news:n0_Fa.4855$JN6.818060@news20.bellglobal.com

OO Programming is not the Panacee and I don’t like Ruby because my mind

is

much less stimulated programming with it.
I mean if you have to “turn right and become red” then Ruby has already

a

method doing that.
And you can use it like this : Object.turn_right_become_red
I prefer doing that by programming instead of writing something which
someone has already programmed for me. Because people saying that since

they

program with Ruby they don’t want to program with another language are

true

: they are not adapted anymore with popular but harder programming

language.

I mean you have to train your brain and not to become lazy with it.

That’s

why after programming a little bit with Ruby and with Perl I choose

Perl.

Perl brings fun to programming also because you have to think. If “fun”
means to you playing video games instead of chess then Ruby is for you

and

you will find a lot of obvious advantages of Ruby over Perl…

Anubis

To which I say “thank goodness!”. CPAN is, IMO, a bad model: It’s
only for perl stuff.

How so? Other than the “P” in the acronym, it seems a pretty
standard hierarchical place to store code snippets.

···

Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook™.
http://calendar.yahoo.com

Jason Creighton androflux@remove.to.reply.softhome.net writes:

…or whatever. We need more flexible package managers in general, not just
a language specific package manager every time we feel like we need to
reinvent the wheel.

The problem with solving the general case once and for all is that everyone
talks about it and nobody does it. CPAN may have its flaws, but it beats
anything non-existent hands down.

···


Heh, heh, heh, heh… the NOISE of a bursar CHEWING Proctors’ Memoranda.
- Henry Braun is Oxford Zippy

Jason Creighton wrote:

To which I say “thank goodness!”. CPAN is, IMO, a bad model: It’s only for
perl stuff. We don’t need to reinvent CPAN for Ruby: What we really need
is a package manager flexible enough so that we can just do a:

~$ ultimate_package_manager --add-source http://www.ruby-lang.org/raa
~$ ultimate_package_manager --install raa/testunit

…or whatever. We need more flexible package managers in general, not
just a language specific package manager every time we feel like we need
to reinvent the wheel.

Jason, I couldn’t agree more. The one thing that has made perl
horrendously hard to maintain on most systems is that it ignores the
system package manager, whatever that is, be it ports, portage, rpm,
dpkg, or whatever else.

What Ruby needs is good tools for package maintainers to use to make
their packages extremely easy to distribute in a system distribution,
/and/ makes it easy for someone to download and install a package from
the web.

If there were a standard set of commands as widely understood as
“./configure” “make” “make install”, then there would be no need for a
CPAN-alike repository and build and test system – wget and a shell
would be all that is needed, and a very simplistic tool to search the
RAA, download the package and execute the standard commands would be
very easy to create.

If one could coerce developers to “just toss in a copy of install-foo.rb
and edit installer-conf” to create an easily installable package, one
could benefit from easy integration with existing package managers, have
easy manual package building, and have a “one-command-does-it-all” tool
ala cpan’s shell.

Some hypothetical examples:

ruby-package-get syck

RPM detected – building packages.
Downloading package list from RAA… done.
Finding syck… done, 2 prerequisites.
Downloading syck… done
making spec files… done

  • rpmbuild -ba prereq1.spec
  • rpmbuild -ba prereq2.spec
  • rpmbuild -ba syck.spec
    RPMS are in ~/rpm/RPMS. Installing…
  • rpm -i ~/rpm/RPMS/{prereq1-0.0.0,prereq2-0.0.0,syck-1.0}.noarch.rpm
    Done!

That’s all doable: the PLD team has done similar hacks (mostly ripping
most of the features out of) to CPAN – they have scripts to build RPMs
out of CPAN entries. If it were a native function of CPAN, it’d be much
easier. Similar can be done for other package managers.

Ari

Hi,

···

In message “Re: Ruby disadvantages over Mind” on 03/06/13, “Brett H. Williams” brett_williams@agilent.com writes:

So perl is better because it’s harder and you have to think more? I doubt
any perl advocates would want you to use this argument on their side in
this one… :wink:

Some people really love to solve hard puzzles. I respect them.
I’m not as good as Larry at making puzzles. sigh.

						matz.

Hmmm… I don’t really like calling it “_!”. There’s no clean way to make it
look like math notation, so I wouldn’t try. Lets call it “factorial”. We can
claim we did for smalltalk compatibility. :slight_smile: (Smalltalk’s numbers have a
“factorial” method.)

Also, I would probably implement it thus:

class Integer
def factorial
(1…self).inject { |f, n| f * n }
end
end

…just in case we want to calculate the factorials of numbers larger than
230 - 1 :slight_smile: Actually, to quote the pickaxe, “A Fixnum holds Integer values
that can be represented in a native machine word (minus 1 bit).” And another
bit goes to sign, (I think so, anyway) off by one due to starting at zero, and
you’ve got the upper limit as 2
30 - 1. (On 32 bits machines)

Jason Creighton

···

On Thu, 12 Jun 2003 12:28:06 +0900 Daniel Carrera dcarrera@math.umd.edu wrote:

Here are two examples. The point of them is not that it’s hard to “do” in
Perl, but rather, that the Ruby solution has a very natural syntax.

Example 1:

Task: Compute factorials, combinations, permutations and binomial

  • ----- distributions.

Code:


Factorial.

class Fixnum
def !
self < 0 and raise “Factorial only defined for non-negative
numbers” self == 0 and return 1
self * (self - 1).
!
end
end

See, that’s the problem with chess computers: They’re so good at it, it’s no
fun for causual players like myself because I can never win. Sure, I like a
challenge, but a computer will always play at the same level. That is, once
you’re behind, you have almost no chance of winning the game because
brute-force algorithms never make a mistake.

Actually, that’s one of the problems. The other is that it’s more fun to
play against a person.

Jason Creighton

···

On Thu, 12 Jun 2003 22:26:16 +0900 Gavin Sinclair gsinclair@soyabean.com.au wrote:

I like video games and chess, but probably chess more.

I like Perl and Ruby, but definitely Ruby more!

I just defeated a chess program written in 1982 for C64. I won a
bishop in the middlegame, but at the cost of a couple of pawns, and it
was touch and go in the endgame. (Sigh, I thought I’d slaughter
it…)

Yes, given that perl’s OO is wonky. The object reference is
stringified before use, as someone else mentioned.

The point is that things other than strings can be used.

···

— Mauricio Fernández batsman.geo@yahoo.com wrote:

On Thu, Jun 12, 2003 at 11:06:55AM +0900, Michael Campbell wrote:

  1. any type of object can be used as a key in a Ruby hash (Perl
    can
    only use strings as keys).

I don’t think this is accurate. This works perfectly fine in
perl:

$hash{1.0} = “foo”;
keys %hash # => “1” or 1, depending on context.

That because Perl mixes strings and numbers, isn’t it?
But is the following possible?


Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook™.
http://calendar.yahoo.com