develooper Front page | perl.perl6.language | Postings from December 2004

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

Thread Previous | Thread Next
From:
Michele Dondi
Date:
December 10, 2004 05:07
Subject:
Re: Arglist I/O [Was: Angle quotes and pointy brackets]
Message ID:
Pine.LNX.4.61.0412091002440.7697@leia.pcteor1.mi.infn.it
On Fri, 3 Dec 2004, Larry Wall wrote:

> On Fri, Dec 03, 2004 at 06:43:05PM +0000, Herbert Snorrason wrote:
> : This whole issue kind of makes me go 'ugh'. One of the things I like
> : best about Perl is the amazing simplicity of the <> input construct.
>
> Hmm.
>
>    while (<>) {...}
>    for .lines {...}
>
> Looks like a wash to me.

Partly it does. The point is that not only the <> is simple, but that it 
is also visually distinctive, which is important IMHO.

Obviously the new proposal of unary C<=> is just as good from this point 
of view...

> : Replacing that with something that not only is object oriented, but on
> : top of that also LOOKS object oriented is bound to be a loss. It's
> : going to be that bit longer to write, and not the least bit easier to
> : understand.
>
> Really?  I dare you to show those two lines to any random
> computer-literate but non-Perl-speaking stranger and see which one
> they understand better.

Of course they'd understand better the latter, but I think that there's a 
limit to non-Perl-speaking-people-friendship. After all this may be useful 
for learning perl, but learning it to a good degree would always involve 
getting acquainted with quite a lot of typical idioms, so this does not 
make much of a point IMHO, provided that when a typical user becomes 
familiar with those idioms he can perceive (i) how good they look in 
source code (ii) how useful they result in practice.

> It's all cargo cult at that level anyway, so whether it looks OO or not
> is really completely immaterial to its usability.

Indeed it's not *purely* a matter of "looking OO", but of "looking yet 
another more-or-less alphabetic string" (yes, even with a prepended point: 
it's just not as markedly distinctive!). As I said, <> is deeply etched in 
Perl programmers' cortex as an input operator. In other words it may well 
be cargo cult, but not in a totally negative acceptation: I mean... till 
it works, and works well as it currently does!

> And I don't buy the nuclear blackmail argument either.  I'll start
> worrying about people switching to Python and Ruby when those languages
> get a clue about how natural languages work.  As far as I know, there's

OTOH, as a side note, but not a totally unrelated one, I guess, one should 
pay some attention not to exaggerate following natural languages 
principles in designing programming languages: granted, I appreciate their 
pervasiveness in (current) perl and indeed probably this is one of the 
reasons I love it. But I think that there are some natural limits to this 
as well: AFAIK any attempt to overcome them was basically a failure. We 
want the *right* mixture of conciseness, intutivity, clarity instead. In 
this sense a construct like

   while (<>) {
     ...
   }

really doesn't resamble any natural language construct as far as I can 
see, but indeed it's an idiom that perl programmers easily become familiar 
with and like to use... well, I think so!


Michele
-- 
>I hold a square measuring 10x10 metres away from a person who is standing
>100 metres away.
>I ask them to shoot the square with a high-accuracy gun.
Don't stand there holding the square when they are shooting...
- Robert Israel in sci.math, "Re: Scaling"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About