3 ms·
I have two programming tattoos: a Perl camel and a Ruby ruby. That basically tells the story of why Perl didn't win for me: As soon as I started learning Ruby,
by steveklabnik 12y ago
I have two programming tattoos: a Perl camel and a Ruby ruby. That basically tells the story of why Perl didn't win for me: As soon as I started learning Ruby, I thought, "Oh, a cleaned-up Perl" and never really wrote any Perl code again.
I love Perl's personality, its quirkiness, and its massive amount of libraries. Perl was _massively_ influential on me as a young programmer. But I'm pretty sure that I won't be writing any Perl ever again.
- Roboprog 12y agoExactly. Perl 6 was forever delayed, and along came Ruby. Or rather, out from the shadows came Ruby, which was already there before the Perl 6 debacle, and just needed promotion. The Pragmatic Programmer books were pretty good at pointing to this cool replacement for Perl that you never knew was already there (as well as all the buzz from the RoR folks for those of us who weren't in on the beginning) I don't really think that the people who left perl all went to PHP. Now if only there was a "Ruby lite" that ran more like Perl 5 (skipping the GC for reference counting and a few other performance shortcuts)
- Poiesis 12y agoI'm wondering if Swift will fill that role, eventually.
- Roboprog 12y agoI hope so. That is, I hope there is a version of Swift outside of Apple-land (Clang compiler for LLVM extension???). What little bit I have seen so far looks promising, and it has a significant sponsor to get the language going.
- mst 12y agoruby is awesome until I want OO ... then I get about an hour in and find that I've got to write 5x as much boilerplate as I would under Moose/Moo, and there's no proper trait/role system, and then I get annoyed and go back to perl. If ruby had OO as good as Moose, I'd seriously consider switching. Sadly the projects to port Moose to ruby never seem to get finished.
- steveklabnik 12y agoMoose came out five or six years after I made the move, so I'm not super familiar. Can you expand on some of this? I very, very rarely need 'boilerplate' in Ruby...
- mst 12y agoTwo examples. Note that I'm going to write the boilerplate-ish version in perl as well, because I think it'll be equivalent and that's probably more likely than not screwing up the ruby code. Please correct me if it isn't equivalent. Most of my object attributes look like one of - has foo => (is => 'ro', required => 1); has bar => (is => 'lazy', builder => sub { Some::Logic::here() }); which translates through to, in old-school perl style, sub new { my ($class, $args) = @_; my $new = bless({}, $class); $new->_init($args); return $new; } sub _init { my ($new, $args) = @_; die "foo is required" unless exists $args->{foo}; $new->{foo} = $args->{foo}; if (exists $args->{bar}) { $new->{bar} = $args->{bar}; } } sub foo { $_[0]->{foo} } sub bar { my ($self) = @_; unless (exists $self->{bar}) { $self->{bar} = $self->_build_bar; } return $self->{bar} } sub _build_bar { Some::Logic::here(); } So far as I'm aware, ruby provides 'attr_reader' which would generate the 'foo' method for me, and of course the above 'new' is built-in. However, again so far as I'm aware, I'd still have to write the bar() lazy/build accessor, and an initialize() method to do the equivalent of '_init' - and name _build_bar by hand, which is less of a big deal but turns out to be really quite nice. Plus I'm unaware of any ruby equivalent for the Class::Method::Modifiers CPAN module, although I'd imagine that's pretty easy to write and wouldn't be surprised if there's a gem somewhere that I've missed. In fact, there's a MooseX gem that brings some of this syntax to ruby already, which suggests that it isn't already there anywhere else or at least that that gem's author didn't find it either; next time I play with ruby I intend to do so with the assistance of said gem and maybe that'll solve my problem, but I'm open to being told I'm doing it completely wrong - this isn't me harshing on ruby so much as complaining that an otherwise rather pretty language isn't something I can enjoy writing and I'd like to fix that.
- 12y ago