ubuntu terminal directory
David Hummel
lemmuh-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Mon Mar 29 09:09:11 EDT 2010
On Sun, Mar 28, 2010 at 11:18 PM, Derek Martin <invalid-yPs96gJSFQo51KKgMmcfiw at public.gmane.org> wrote:
>
> You can also write very unreadable code in any language. Some just
> seem to encourage that more than others... that's always been my
> gripe with Perl. I've seen plenty of readable Perl code, but I've
> seen far less unreadable Python than Perl. Perl is a semantically
> large language with lots of clever shortcuts, which in my mind really
> only lend themselves to encouraging unreadable code.
That's very true. For any serious code that could potentially be read
by someone other than me (which is most of the code I write), I tend
to throw all that syntactic sugar out the window in favor of more
verbose and readable code constructs. But it's all that syntactic
sugar that allows me to be very expressive and hence more productive
in my day to day use of Perl (single-use scripts, one-liners, etc.).
> The size and inconsistency of the syntax of Perl force a much greater... ah...
> let's say learning investment, and complicates maintaining someone
> else's code by orders of magnitude.
Inconsistency is only introduced by the programmer, not by the
flexibility of Perl syntax. There's many ways to do the same thing
(TIMTOWTDI is a main tenet of the language), but if you write code
that uses irregular combinations of the aforementioned syntactic
sugar, then of course the inexperienced Perl programmer will get
confused quickly.
> Everyone makes an issue of that. Honestly, at first I didn't like the
> forced indentation, until I had an epiphany: I would never
> (intentionally) write code that's not consistently indented. Doing so
> makes the code less readable. So it immediately became a non-issue
> for me. If you use a modern editor, and configure it well, you don't
> even have to think about it.
I have to agree there, but it still seems strange to have the compiler
rely on indentation though, especially when no other modern languages
care about this. I'd prefer not to have my code fail to compile and
run just because I left out some white space somewhere.
> Besides, everything to do with OOP in Perl is ugly.
Things are always ugly if you're not used to them ;-) Just as with
indentation in Python, everyone gripes about the object system in
Perl, but it makes sense if you consider the design history of Perl.
OO features were tacked on once it seemed necessary and fashionable to
support OOP. That's all about to change with Perl 6 though.
> Python also has much better exception handling.
What does "better" mean? I think what you mean is that the syntax for
it is cleaner in Python. That I would agree with.
> I'm not going to say that Perl is a bad language, but I
> will say that I've never enjoyed programming with it, no matter how
> well I've gotten to know it.
Fair enough. To each his own ;-) It's obviously important to use
tools that you enjoy working with whenever possible.
More information about the Discuss
mailing list