[Melbourne-pm] Google Wave Anyone?
Shlomi Fish
shlomif at iglu.org.il
Thu Oct 29 05:01:18 PDT 2009
Hi Toby!
My 2 cents / 2 Eurocents / 20 Israeli agoroth / whatever.
On Thursday 29 Oct 2009 02:29:35 Toby Wintermute wrote:
> 2009/10/28 Alec Clews <alec.clews at gmail.com>:
> > Hello,
> >
> > In a vain attempt to find something useful to do with Google Wave I have
> > started a MELB PM Wave.
> >
> > Contact me at alecclews at googlewave.com to be added.
>
> I'm sad that I've had to brush up on Javascript in order to use Wave
> stuff. (And Java for Android)
> Waah.. Where's the Perl love gone?
Well, technically speaking you can script web-pages using any embedded
language of your choice, however no web-browser can guarantee it supports any
language (including perhaps JavaScript). However, since
JavaScript/JScript/etc. is the only language supported by most common
browsers, it is the only one you can afford to use. There used to be a
PerlScript add-on for Internet Explorer, and it would be doable to implement a
compatible embedded Perl for the Mozilla project, but again it will assume
some extra dependencies that many laymen won't bother to install.
I tend to agree that JavaScript sucks incredibly badly as a language (though
I've known worse languages) and that "In JavaScript, the good parts are not
original, and the original parts are not good.". I also loath the fact that
many commercial and lately even open-source systems only give you JavaScript
as a scripting language even if it's not web-related. (e.g: QtScript as used
by Amarok 2.x). But I think I should stop because this is not the Melbourne
anti-JavaScript mongers.
>
> In other news; I'm liking Moose a lot, especially since the .9 release
> with all the built-in attributes and corresponding traits.. but I'm
> curious to know what everyone else thinks of Moose.
OK. It's a long story for me. Back when I started learning Perl 5 in 1996ish,
I was already well-versed in C/C++ and thought the C++ OOP was OK. I knew that
Perl 5 had modules and objects, but wrote most of my Perl 5 scripts and
programs without modules, packages or objects, and while using evil hacks as
slurping a file and eval'ing it. (No "use strict;" either - ;-)). Classic Web
1.0 Perl.
Later on, I learned about modules and somewhat later about objects, and was
amazed at how much better Perl 5's OOP was than C++'s and as a result coined
the aphorism "C++ supports Object Oriented Programming roughly as much as
COBOL supports Functional Programming." (i.e: hardly at all.). I should note
that I didn't do too much serious programming in languages whose support for
object-oriented programming is reportedly better than Perl: Smalltalk, Ruby,
Common Lisp (with CLOS), etc. so Perl 5's OOP may actually suck a lot in
comparison.
In any case, when I wrote the third part in the Perl for Perl Newbies
installment about subroutine references, modules and objects, I did not cover
the use of accessors, and Moose did not exist back then:
http://perl-begin.org/tutorials/perl-for-newbies/part3/
Later on, I started using Class-Accessor and other accessor generators, and
immediately understood why accessors (setters, getters, mutators, etc.) are a
good idea, and also wrote some different kinds of run-time generated methods
by hand using the *Package::$name = sub { ... # something with $name }; trick
to avoid repetitive code.
Regarding Moose - I've lately been feeling that I finally drank the Moose
kool-aid, though I admit I actively make use of a very small part of what
Moose has to offer (which is still much better than what Class-Accessor gives,
along with the many OOP hacks I did). I agree with scrottie here -
http://use.perl.org/~scrottie/journal/38289 - that Moose is a leaky
abstraction and you still need to know how things work at the lower levels and
behind the scenes. ּSo I suggest people first learn perlobj/etc. and only then
Moose.
I still haven't converted all my CPAN modules to Moose, nor do I intend to
convert some of them. File-Find-Object will remain using Class-XSAccessor for
the time being, because it's the fastest solution among accessor generators,
and because F-F-O is already pretty slow in comparison to File::Find, based on
a (possibly not very real-world) benchmark. But still, I've been keepiing most
of the Moose syntax that is immediately useful to me in the near-term memory,
and appreciate the extra strictness and run-time error checking.
> It's evidently superior to Perl's existing OO framework, which has
> been showing it's age and tacked-on-afterwards feel for a long time..
> but on the other hand, Moose involves learning a quite different
> syntax, and in some ways you're barely working in Perl.. and if you
> wanted to learn whole new syntax, you could have learnt Ruby or Jython
> or NOOP instead.
Moose's syntax is just an adaptation of the normal Perl 5 syntax (without any
source filters or whatever). It's not as brief as the Perl 6 notation, but it
is not special as far as Perl is concerned. Some people are using MooseX-
Declare and friends which are much more magical (though not really source
filters from what I understood), but naturally they are optional.
I had some bad experience with Error.pm and friends, which are not source
filters, but also very magical and very leaky abstractions that people kept
reporting false bugs for (due to not doing "use Error qw(:try);" or doing
return inside an Error.pm clause which is implemented as a closure), and
someone said we should fix them despite the fact that it is not very possible
with the current Perl 5 feature-set. I've recently started using
Exception::Class without the Error.pm syntactic sugar and am much happier.
So I think I'll avoid MooseX-Declare / Devel-Declare / etc. for the time
being, because I heard that while they are not as bad as Error.pm is (and
naturally more robust than the average source filter), they still cause lots
of problems.
Regarding what you said about "I might as well learn Ruby or Jython or
whatever instead" - in that case you will lose all your Perl knowledge and
also won't be able to make use of CPAN or whatever as easily. Moose is still
100% Perl 5, and Perlish. I encourage every Perl programmer (or any
programmer) to learn as many computer languages as possible, and if you like a
language more or feel it is better for some tasks, feel free to use it instead
of Perl. But naturally, as Joel on Software noted in his notorious "Language
Wars" post, not all development platforms have an adequate brain-share,
robustness, choice of APIs, corporate backing, proper documentation and
support, and/or social aspects that some popular development platforms have.
(And I'm not saying it is necessarily true for Perl.) At the end of the day, I
find that I still prefer to write most of my production code in Perl.
>
> I see Moose as good because it enables you to update Perl and it's
> objects, while still retaining compatibility with existing code and
> CPAN. I think we all agree that CPAN is a major strength of Perl.
> UNLIKE fun things like DBIx::Class or Catalyst, Moose only has a few
> dependencies so it's not hard to install, or persuade your sysadmins
> to install. (Although of course, the debian-stable packaged version is
> too old to really satisfy.)
Debian-stable is always a problem.
> However, Moose does really appreciate a Perl 5.10.x running it; it'll
> work fine on 5.8.x but you get a measureable performance hit. (But
> hey, when even Debian is packaging perl 5.10, you *know* you're behind
> the times if you're still on 5.8, right?)
>
> What are your feelings on the matter?
Like I said I think you should first learn perlobj/etc. and the basics of OOP
programming in Perl (while being told that you'll soon see a better syntax),
and only then Moose.
Sorry for the longish email - I got carried away telling the history of my
Perl introduction to OOP, which I think other people here can relate to.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
First stop for Perl beginners - http://perl-begin.org/
Chuck Norris read the entire English Wikipedia in 24 hours. Twice.
More information about the Melbourne-pm
mailing list