From: Rob Dixon <[EMAIL PROTECTED]>
> Jenda Krynicky wrote:
> > From: Rob Dixon <[EMAIL PROTECTED]>
> >> Well yes, of course that's possible. But you're advocating abandoning
> >> strictures and writing unintelligible code by proposing it.
> >
> > Beg your pardon? use strict doesn't have any problems with that code.
>
> What I meant was that a code fragment without 'use strict' is acceptable,
> but since your program starts with
>
> #!perl
> use XML::Generator;
>
> you are clearly posting the entire code and thereby encouraging the
> omission of strictures. It's hard enough as it is to get people to use
> them as a matter of course without a regular poster setting a precedent
> like this.
I see. You may be right
> > And if you find map{} uninteligible it's your problem, not the code's.
>
> What exactly does that mean?
I think I overacted. I've seen too many people claiming that map{}
makes for hard to read code where the whole problem was that they
were unable to stop thinking in C. To me, with some background in
functional languages, map{} feels natural. Just like regexps.
Which is good when coding, but sometimes not so good when trying to
help people.
> > map{} just transforms a list, what's so hard about it?
>
> Nothing Jenda. But just imagine coming across the line
>
> map { $gen->user({id => $ref->{$_}}, $_) } keys %{$ref}
>
> in code you'd never seen before. Are you telling me its intent
> would leap out at you instantly? I think most people would take
> at least several seconds, and even then would want to reassure
> themselves that their understanding was correct.
I see. Well I'd probably get a little lost in all those braces for a
second so
map {
$gen->user( {id => $ref->{$_}}, $_)
} keys %{$ref}
would probably be better. And the reason why I might stop for a
second is that Perl uses {} for both blocks and hashes. Which is
understandable with the limited list of bracelike characters, but
still sometime requires a bit too much context when parsing.
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/