A crosspost from the Perl Community

We need to solve something, the perl guys do it.

Oh, something was lost. I actually meant we BOTH (ruby folks, and perl
folks)
need to solve a (or several) specific problem(s).

Then we can see which language is cleaner.

···

--
Posted via http://www.ruby-forum.com/\.

David Masover wrote:

I really don't think Perl can be made as pretty as Ruby, but then, Perl
has
Acme::Lingua::Pirate::Perl, so anything's possible.

And I don't think Ruby can be made pretty at all.

> Every language can be made messy. Not every language can be made clean.

Agreed. For example with the meaningful newlines there are cases when
you can't make the Ruby code clean, because you either can't break the
overly long line or you can, but you end up with an operator lost on the
far right or with some silly line continuation character.

However, with required semicolons, you have every line looking ugly,
except
just the edge cases. And that's just line endings -- never mind the
dereference operator and $calar prefix that become pretty much pure
annoyance
for OOP.

I hate languages that do not use any sigil. I want to know what is a
variable and what is not and be able to tell the difference at the very
first glance. And not have to think about what methods, functions,
classes, ... exist or might exist in the future when naming my
variables.

And for the semicolons making every line look ugly ... every sentence in
english ends with a dot, except for those that end with a question or
exclamation mark. Does that make the sentences ugly? A statement in a
program is a sentence and a sentence should end with a marker, not fall
off at the end of line unless I bend backwards.

Oftentimes the classes are simple to make but do they give you anything?

Yes, it's called Object-Oriented Programming. Perhaps not in every case,
but I
would argue that because of how much more tedious Perl makes classes --
and
nice patterns like setters/getters -- there are going to be cases where
a
separate class would really be appropriate, but Perl people will tend
towards
data structures instead.

OOP is not a holly grail, the fact that something is made into a class
with getters and setters doesn't make it any better in itself. A class
that only has the default getters and setters is a pointless class. No
matter how easy was it to create it. You should not be creating classes
just because you can, you should do that because it allows for a cleaner
code, because it allows you to hide some complexity from whoever's using
that class.

I don't think this is a comment on the actual languages, but their
respective
communities. If people are drawn to Ruby because of pretty syntax,
they're
probably likely to hold clean, readable syntax as a desirable goal.

I don't think people get drawn to Ruby because of pretty syntax. I think
it's all marketing. Ruby on Rails is (or is it still?) hip. The new cool
kid on the block.

Jenda

···

--
Posted via http://www.ruby-forum.com/\.

Can you give an example? I'm curios because I never missed this and
I'd like to know what I am overlooking. It may be that my mindset is
so Java / Ruby already that I simply do not think in ways that would
make references useful - or I deal with a different class of problems
which can be more easily solved without.

Kind regards

robert

···

2008/6/6 Eric Mahurin <eric.mahurin@gmail.com>:

In ruby, I sometimes miss the ability to easily reference and
dereference lvalues. There is always another way, but having lvalue
references/pointers would sometimes be more elegant.

--
use.inject do |as, often| as.you_can - without end

Does Star Cross reply?

Seems a bit lost in all this. A heavy perl user that praises perl
including it's disadvantages... perl is readable?

Yeah. For C fossil coders maybe. 8)

Let's challenge the perl folks. They claim that perl is more readable
than ruby?

Let's make a rubyquiz-perlquiz challenge.

We need to solve something, the perl guys do it.

Then we compare our solutions. (Only "in-built" stuff is allowed, i.e.
no cpan modules rubygems etc... things would have to be used from
scratch, so that no language gains an inherent advantage over the other)

···

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

Marc Heiler wrote:

We need to solve something, the perl guys do it.

Oh, something was lost. I actually meant we BOTH (ruby folks, and perl
folks)
need to solve a (or several) specific problem(s).

Then we can see which language is cleaner.

Who's gonna be the judge? Besides, define cleaner!

No matter the solutions, the Ruby ones will look cleaner to the Ruby
proponents and the Perl one to the Perl ones. There's nothing to be
gained from this exercise.

Jenda

···

--
Posted via http://www.ruby-forum.com/\.

<...>

And for the semicolons making every line look ugly ... every sentence in
english ends with a dot, except for those that end with a question or
exclamation mark. Does that make the sentences ugly?

In English you do not write every sentence on the separate line, hence
the need to have something to mark the end of the sentence.
Same in Ruby, if you put several statements in one line you use semicolons
to separate them.

A statement in a program is a sentence and a sentence should end with
a marker, not fall off at the end of line unless I bend backwards.

Yep, it ends. That marker is newline. Pretty good choice - it marks the end
of the statement and does not bring any visual clutter. I like this a lot,
others may not like it, but they have a bunch of other languages to choose from.
<...>

Regards,
Rimantas

···

--
http://rimantas.com/

<snip>rant</snip>

You do not have to use Ruby if you do not like to.

I don't think this is a comment on the actual languages, but their
respective
communities. If people are drawn to Ruby because of pretty syntax,
they're
probably likely to hold clean, readable syntax as a desirable goal.

I don't think people get drawn to Ruby because of pretty syntax. I think
it's all marketing. Ruby on Rails is (or is it still?) hip. The new cool
kid on the block.

That's not true for me. I don't use Rails but I do use Ruby because
of its OO capabilities and the clean syntax. I was attracted way
before the hype and I believe Rails did not even exist at that point
in time.

Regards

robert

···

2008/6/13 Jenda Krynicky <jenda@cpan.org>:

--
use.inject do |as, often| as.you_can - without end

Did you just join this mailing list to be a douchebag?

I can't believe this conversation is still going. "OMG PERL AND RUBY
HAVE DIFFERNET SYNATXCES." Yes. They do. If you hate Ruby's, that's
fine, but having worked with Perl, PHP, Java, and C# before I found
Ruby, I find it refreshing. The cleaner syntax and more powerful
language structures make C# and friends feel brittle and old.

But everyone's entitled to their own opinion, of course. Just don't
blame people digging Ruby on a web framework and "marketing" (whatever
that means). That's just silly.

--Jeremy

···

On Fri, Jun 13, 2008 at 7:16 AM, Jenda Krynicky <jenda@cpan.org> wrote:

David Masover wrote:

I really don't think Perl can be made as pretty as Ruby, but then, Perl
has
Acme::Lingua::Pirate::Perl, so anything's possible.

And I don't think Ruby can be made pretty at all.

> Every language can be made messy. Not every language can be made clean.

Agreed. For example with the meaningful newlines there are cases when
you can't make the Ruby code clean, because you either can't break the
overly long line or you can, but you end up with an operator lost on the
far right or with some silly line continuation character.

However, with required semicolons, you have every line looking ugly,
except
just the edge cases. And that's just line endings -- never mind the
dereference operator and $calar prefix that become pretty much pure
annoyance
for OOP.

I hate languages that do not use any sigil. I want to know what is a
variable and what is not and be able to tell the difference at the very
first glance. And not have to think about what methods, functions,
classes, ... exist or might exist in the future when naming my
variables.

And for the semicolons making every line look ugly ... every sentence in
english ends with a dot, except for those that end with a question or
exclamation mark. Does that make the sentences ugly? A statement in a
program is a sentence and a sentence should end with a marker, not fall
off at the end of line unless I bend backwards.

Oftentimes the classes are simple to make but do they give you anything?

Yes, it's called Object-Oriented Programming. Perhaps not in every case,
but I
would argue that because of how much more tedious Perl makes classes --
and
nice patterns like setters/getters -- there are going to be cases where
a
separate class would really be appropriate, but Perl people will tend
towards
data structures instead.

OOP is not a holly grail, the fact that something is made into a class
with getters and setters doesn't make it any better in itself. A class
that only has the default getters and setters is a pointless class. No
matter how easy was it to create it. You should not be creating classes
just because you can, you should do that because it allows for a cleaner
code, because it allows you to hide some complexity from whoever's using
that class.

I don't think this is a comment on the actual languages, but their
respective
communities. If people are drawn to Ruby because of pretty syntax,
they're
probably likely to hold clean, readable syntax as a desirable goal.

I don't think people get drawn to Ruby because of pretty syntax. I think
it's all marketing. Ruby on Rails is (or is it still?) hip. The new cool
kid on the block.

Jenda
--
Posted via http://www.ruby-forum.com/\.

--
http://jeremymcanally.com/
http://entp.com

Read my books:
Ruby in Practice (http://manning.com/mcanally/\)
My free Ruby e-book (http://humblelittlerubybook.com/\)

Or, my blogs:

http://rubyinpractice.com

I want to know what is a
variable and what is not and be able to tell the difference at the very
first glance.

Difference of philosophy -- with the simple setters and getters, the idea is
to start using it as a variable, but it might not always be.

And not have to think about what methods, functions,
classes, ... exist or might exist in the future when naming my
variables.

So you still have to think about what methods (or functions) exist when naming
your methods (or functions). No one's stopping you from naming variables like
var_foo -- or using mostly instance variables, like @foo (which does have a
sigil).

And for the semicolons making every line look ugly ... every sentence in
english ends with a dot, except for those that end with a question or
exclamation mark. Does that make the sentences ugly?

I don't think so, but I do think it would make syntax ugly, if syntax were
written the way prose were:

while line = gets; fields = line.split("\t"); puts fields[3]; end

As someone else pointed out, in mediums where sentences aren't always written
as part of paragraphs, the period is often dropped -- poetry, for example, or
instant messaging.

OOP is not a holly grail,

Strawman -- I didn't say that.

the fact that something is made into a class
with getters and setters doesn't make it any better in itself. A class
that only has the default getters and setters is a pointless class. No
matter how easy was it to create it.

Actually, there is a point -- such a class is abstract. Contrived example:

class Person
  attr_accessor :name, :income, :disposition
end

class Employee < Person
  def income
    if disposition == :rebellious
      0
    else
      @income
    end
  end
end

Simple translation: A class can have its attributes overridden -- or you can
outright pass in an object that isn't even inherited, but provides the needed
methods.

A hash, say, makes this much clumsier, though it can still be done.

I don't think people get drawn to Ruby because of pretty syntax. I think
it's all marketing. Ruby on Rails is (or is it still?) hip. The new cool
kid on the block.

You know, I saw an interview question to DHH, asking him why he chose Ruby. It
was all about which language would allow him to write "the most beautiful
code." Or, in other words, it was all about pretty syntax.

···

On Friday 13 June 2008 06:16:00 Jenda Krynicky wrote:

A general category would be data structures of a linked set of nodes -
trees (i.e. AVL, red-black, splay, B), linked lists (single, double),
graph, etc. Each node can be easily represented in Ruby with an
object that has one or more instance variables for the "links" where
each link holds another node or nil. Many operations may equally
apply to the head/root of the data structure or somewhere in the
middle (a sub head/root). Not a problem for Ruby as long as this
operation doesn't want to modify the link at that point. In other
languages we might pass a reference/pointer of the variable with the
link so that it could be modified. In Ruby, you'll have come up with
another solution: a) pass the node containing the link you want to
operate along with something saying which link in the node (you'll
probably also need a dummy node at the root/head), b) have a separate
object for the link so you can pass it around (i.e. simply an Array of
one element), c) pass a lambda that can modify the link. None of
these are as elegant as an lvalue reference IMHO. In my early ruby
days a few years ago I put some code in the rubyforge "reference"
project. I still think having something like this readily available
would be useful.

External iterators are also like lvalue references and is something
ruby is missing (IMHO). An external iterator could be thought of as a
superset of the reference/pointer concept (external iterator looks
like a pointer in C++).

Both (lvalue) references/pointers and external iterators could be
implemented with normal ruby classes and methods (in ruby or more
efficiently in C).

Eric

···

On Fri, Jun 6, 2008 at 7:29 AM, Robert Klemme <shortcutter@googlemail.com> wrote:

2008/6/6 Eric Mahurin <eric.mahurin@gmail.com>:

In ruby, I sometimes miss the ability to easily reference and
dereference lvalues. There is always another way, but having lvalue
references/pointers would sometimes be more elegant.

Can you give an example? I'm curios because I never missed this and
I'd like to know what I am overlooking. It may be that my mindset is
so Java / Ruby already that I simply do not think in ways that would
make references useful - or I deal with a different class of problems
which can be more easily solved without.

Phlip wrote:

Let's make a rubyquiz-perlquiz challenge.

Perl is not a worthy adversary.

Here's Ruby calling a method:

   foo.bar(42)

Perl calling a method:

   $foo->{bar}(42);

Oh, and what does the 42 look like inside the method? local var = unshift?

Perl calling a method will look like

$foo->bar(42);

The argument 42 inside the method will normally look like

my $whatever = shift;

You don't usually want/need "local" these days. Note that if there are a
number of arguments you might do

my ($arg1, $arg2, ...) = @_;

AHS

···

--
* change 'two' to '2' to email me

You would need a third party.

Todd

···

On Fri, Jun 6, 2008 at 1:27 PM, Jenda Krynicky <jenda@cpan.org> wrote:

Who's gonna be the judge? Besides, define cleaner!

No matter the solutions, the Ruby ones will look cleaner to the Ruby
proponents and the Perl one to the Perl ones. There's nothing to be
gained from this exercise.

That would still potentially be a comparison of standard libraries. And you
can't get away from that, really.

But it is a valid point that beauty is in the eye of the beholder. Almost no
one I know who's seen Ruby code argues that Perl is better -- but then,
almost no one I know dislikes Firefly or Serenity. I'm finding out that the
Internet is a bigger place -- if there is an opinion, someone holds it.

Some people hate Firefly.

···

On Friday 06 June 2008 12:21:08 Marc Heiler wrote:

Then we compare our solutions. (Only "in-built" stuff is allowed, i.e.
no cpan modules rubygems etc... things would have to be used from
scratch, so that no language gains an inherent advantage over the other)

From: "Jenda Krynicky" <jenda@cpan.org>

And for the semicolons making every line look ugly ... every sentence in
english ends with a dot, except for those that end with a question or
exclamation mark. Does that make the sentences ugly?

In English you do not write every sentence on the separate line, hence
the need to have something to mark the end of the sentence.
Same in Ruby, if you put several statements in one line you use semicolons
to separate them.

Precisely. Further, when we do write phrases on separate lines in English,
as in poetry, punctuation is placed where it belongs, not forced to appear
unnecessarily at the end of every line.

From: "Jenda Krynicky" <jenda@cpan.org>
I don't think people get drawn to Ruby because of pretty syntax. I think it's all marketing. Ruby on Rails is (or is it still?) hip. The new cool kid on the block.

To paraphrase David Heinemeier Hansson, "f*ck rails."

<grin>

Many on this list have been using ruby long before rails existed.

I was drawn from perl to ruby, eight years ago, because ruby (matz) had
achieved the seemingly impossible: an elegant synthesis of smalltalk and
perl.

I don't feel the need to use OO for everything, but I like OO as a tool.
And OO programming in perl _sucked_. I used to think it was neat that
OO was grafted onto perl with the addition of a single keyword to the
language. But it was such a pain to write OO code in perl, that I rarely
made the effort--even when I really wanted an object. I can still recall
those disappointing deliberations: wow, this bit of functionality I'm about
to implement would be ideal as an object, . . . but . . . eyuuuch . . . too
much of a pain in the ass. So, yes: syntax matters.

Regards,

Bill

···

From: "Rimantas Liubertas" <rimantas@gmail.com>

Hi --

···

On Sat, 14 Jun 2008, Jeremy McAnally wrote:

Did you just join this mailing list to be a douchebag?

I think the word is "troll" :slight_smile:

David

--
Rails training from David A. Black and Ruby Power and Light:
   ADVANCING WITH RAILS June 16-19 Berlin
   ADVANCING WITH RAILS July 21-24 Edison, NJ
See http://www.rubypal.com for details and updates!

This discussion has almost died, so let's increase the ante...

I think the solution is much easier. Against perl.

Perl 5.x won't shake the world anymore. It can continue to exist for 100
years but its impact will shrink and shrink. This is inevitable. Only a
few perl hardcore fans refuse to accept this.
Maybe they should read http://www.reddit.com/r/programming/ daily. I do
so and it is very rare to see ANYTHING of relevance come up in regard to
perl.
(Maybe someone has a graph, but I think I read more lisp references
there, than perl references)
I am not saying there aren't any new great apps in perl. I still see
complicated solutions implemented in C and perl in bioinformatics for
example. I am sure there are countless more areas, so perl will not
become irrelevant SOON. It will be a long and slow death as gradually
people will ditch it in favour for another language (probably only ruby
and python to choose from, i dont think php alone can "replace" perl,
but what one has to understand with php is that it lowered the entry
barrier for new, younger coders. Being a "noob" is no problem, because
they have DECADES of years in the life left to LEARN more.)

It is thus moot to discuss about features in perl or solutions in perl
that are "better". Ruby's syntax beats perl's syntax easily (with eyes
closed). Ruby's OOP approach beats perl anytime. I think in fact I could
say that matz designed ruby to beat perl easily.

And perl is already lying on the ground right now ... no sense to jump
on it further.

Perl 6 might be different as far as the "new" factor will be concerned,
at least I know (or read) of people who are interested in it. I am sure
the hordes of C hackers that like perl (there are many of them) will
jump onto perl 6 bandwagon. Maybe perl 6 will generate a lot of interest
and will manage to hold its promises. Up today one can not download perl
6 AND use it easily (like perl 5.x) though, so this sounds like
vaporware until it becomes a reality.

Knowing that perl 5 won't make a large difference anymore due to the
pressure of php, python and ruby against it (on the "scripting language"
environment), I believe perl borders on becoming irrelevant as time
passes by.

The strongest faction of perl users, in my opinion, are the old C
hackers who are too lazy to switch to python or ruby, and don't do any
(or much) web development either. (I know a few that even write their
blog stuff in C ... )
They will be quick to point out mistakes in any other language, but
refuse to acknowledge bigger problems in perl largely. And who can blame
them? If a tool works, it is totally fine to continue using it. Without
php, ruby and python, I think perl might be still extremely popular. But
pitted against these languages, perl showed it's 1980- age.

Comparing perl only to php might make perl a winner for most of everyday
task http://tnx.nl/php but throwing python and ruby into the pool where
people can choose from, will make it very very hard for anyone to pick
up on perl first.
(And besides, if perl's www focus would have been very strong, maybe we
would never have seen the rise of php.)

In fact why should anyone stop using Perl? And will people?
This is a question only perl can answer and I think the ruby mailing
list is not the proper place to discuss what perl needs to do.

For me, ruby beats perl hands down. I am not even writing that much ruby
code actually... It is much nicer to think in domain specific languages
(or instructions, if one wants to say so), keeping the data in
human-readable files, and have no real limit on where to use it
specifically, be it www, GUI, console app or whatever. (People might
come up with the speed issue, but speed is so overrated for everyday
tasks ......)

The only complaint I can have about ruby is that the documentation could
always be improved. The Pickaxe is great, but I think a language should
have at least a great online and up-to-date reference, similar to php,
on the official site.

···

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

Robert Klemme wrote:

···

2008/6/13 Jenda Krynicky <jenda@cpan.org>:

<snip>rant</snip>

You do not have to use Ruby if you do not like to.

I don't think this is a comment on the actual languages, but their
respective
communities. If people are drawn to Ruby because of pretty syntax,
they're
probably likely to hold clean, readable syntax as a desirable goal.
      

I don't think people get drawn to Ruby because of pretty syntax. I think
it's all marketing. Ruby on Rails is (or is it still?) hip. The new cool
kid on the block.
    
That's not true for me. I don't use Rails but I do use Ruby because
of its OO capabilities and the clean syntax. I was attracted way
before the hype and I believe Rails did not even exist at that point
in time.
  

Ditto . I'm programming in Ruby for more than 6 years now and I still haven't used Rails :).
Clean syntax, beautiful code, enjoyment in programming!
V.-

--
http://www.braveworld.net/riva

In ruby, I sometimes miss the ability to easily reference and
dereference lvalues. There is always another way, but having lvalue
references/pointers would sometimes be more elegant.

Can you give an example? I'm curios because I never missed this and
I'd like to know what I am overlooking. It may be that my mindset is
so Java / Ruby already that I simply do not think in ways that would
make references useful - or I deal with a different class of problems
which can be more easily solved without.

A general category would be data structures of a linked set of nodes -
trees (i.e. AVL, red-black, splay, B), linked lists (single, double),
graph, etc. Each node can be easily represented in Ruby with an
object that has one or more instance variables for the "links" where
each link holds another node or nil. Many operations may equally
apply to the head/root of the data structure or somewhere in the
middle (a sub head/root). Not a problem for Ruby as long as this
operation doesn't want to modify the link at that point. In other
languages we might pass a reference/pointer of the variable with the
link so that it could be modified. In Ruby, you'll have come up with
another solution: a) pass the node containing the link you want to
operate along with something saying which link in the node (you'll
probably also need a dummy node at the root/head), b) have a separate
object for the link so you can pass it around (i.e. simply an Array of
one element), c) pass a lambda that can modify the link. None of
these are as elegant as an lvalue reference IMHO. In my early ruby
days a few years ago I put some code in the rubyforge "reference"
project. I still think having something like this readily available
would be useful.

The usual solution in Ruby would probably be a) which I find perfectly ok. Since the manipulation is typically encapsulated inside a LinkedList class it does not bother me too much if there are two additional elements (for head and tail). :slight_smile: But I can see how this might be a bit more elegant with references (although not as much to create an urgent need for references in Ruby). :slight_smile:

External iterators are also like lvalue references and is something
ruby is missing (IMHO).

Is it?

irb(main):027:0> require 'generator'
=> true
irb(main):028:0> arr = %w{foo bar baz}
=> ["foo", "bar", "baz"]
irb(main):029:0> it = Generator.new arr
=> #<Generator:0x1002ffe8 @cont_endp=nil, @index=0, @block=#<Proc:0x1001bbc4@/usr/lib/ruby/1.8/generator.rb:71>, @cont_yield=#<Continuation:0x1002f5fc>, @cont_next=nil, @queue=["foo"]>
irb(main):030:0> until it.end?; puts it.current; it.next; end
foo
bar
baz
=> nil

An external iterator could be thought of as a
superset of the reference/pointer concept (external iterator looks
like a pointer in C++).

Which is nicely done (in C++'s STL, I mean). But with blocks I don't really miss external iterators. I rarely have to iterate through multiple collections in lock step and if I had #zip served me well.

Maybe I'm just not doing enough development that involves sophisticated algorithms. :slight_smile:

Thanks for your explanation!

Kind regards

  robert

···

On 06.06.2008 17:01, Eric Mahurin wrote:

On Fri, Jun 6, 2008 at 7:29 AM, Robert Klemme > <shortcutter@googlemail.com> wrote:

2008/6/6 Eric Mahurin <eric.mahurin@gmail.com>:

Todd Benson wrote:

Who's gonna be the judge? Besides, define cleaner!

No matter the solutions, the Ruby ones will look cleaner to the Ruby
proponents and the Perl one to the Perl ones. There's nothing to be
gained from this exercise.

You would need a third party.

Todd

Someone who doesn't know either language? Which would not help much
'cause that someone needs to know at least some other programming
language to have any idea whatsoever what's going on in here and then
which ever's closer to his/her language wins.

Spanish makes more sense that English to a portuguese that doesn't know
either, does it say anything about the relative complexity of the two
languages?

Beauty contests are a nice pretext for watching a few chicks in swimwear
(or wet tshirts), but it's not a way to find the most beautiful girl of
the USA in the year 2008. Cause there is no such thing.

Jenda

···

On Fri, Jun 6, 2008 at 1:27 PM, Jenda Krynicky <jenda@cpan.org> wrote:

--
Posted via http://www.ruby-forum.com/\.

Not that I have anything to contribute, but now you have me thinking
about this entire discussion and Rule 34.

I'm scared.

···

On Jun 7, 10:41 am, David Masover <ni...@slaphack.com> wrote:

On Friday 06 June 2008 12:21:08 Marc Heiler wrote:

> Then we compare our solutions. (Only "in-built" stuff is allowed, i.e.
> no cpan modules rubygems etc... things would have to be used from
> scratch, so that no language gains an inherent advantage over the other)

That would still potentially be a comparison of standard libraries. And you
can't get away from that, really.

But it is a valid point that beauty is in the eye of the beholder. Almost no
one I know who's seen Ruby code argues that Perl is better -- but then,
almost no one I know dislikes Firefly or Serenity. I'm finding out that the
Internet is a bigger place -- if there is an opinion, someone holds it.