in reply to Re: Ruby Before Perl? Nah.
in thread Ruby Before Perl? Nah.
Not that this approach doesn't also have issues (e.g. you call method zorch expecting the object to do foo, but instead it does bar and wipes your hard drive . . .), but there is a rationale behind it.
I'm used to seeing posts like this explaining Ruby's object system when it's being contrasted to C++ or Java, but is this really noticably different from Perl's OO system? How does foo.zorch in Ruby differ from $foo->zorch in Perl? If it looks like duck typing and quacks like duck typing... ;)
Indeed, I believe we could use Perl's OO support and operator overloading to do exactly the same things as Ruby does, right down to accessing arrays and hashes with the same kinds of bracket. The reason we don't is twofold:
- Abstraction on the "everything is an object" scale is inefficient. Perl hackers prefer to save it for where it makes their code easier to read and write, instead of religiously abstracting everything just because we can.
- Code is more maintainable when different things look different. Arrays and hashes have very different semantics.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Ruby Before Perl? Nah.
by Fletch (Bishop) on Jun 07, 2008 at 15:48 UTC | |
by chromatic (Archbishop) on Jun 08, 2008 at 03:47 UTC |
In Section
Meditations