Larry Wall skribis 2005-05-02 15:53 (-0700):
> : Starting to look a lot like PHP there.
> And I care about that because PHP is such an unsuccessful language?  :-)
> I'd just like all the opens to sort to the same place in the manual.

One of my biggest problems with PHP is that it puts in the name of
a function information that IMO belongs in an argument or namespace.

In the case of open, I think namespaces make the most sense. Even though
they all return a handle, the way that handle is created is indeed
radically different. And important here, the way they can fail is also
very different. 

A good example of how PHP differs from Perl in this respect is sorting.
Perl provides one sort and that single sort is capable of any kind of
sorting. PHP on the other hand has 16 different *sort functions in the
standard language (core plus extensions in the standard distribution,
because extensions are compiled in). 

More examples can be found at <http://tnx.nl/php>. 

I don't mind having numerous aliases to harder to find neatly
categorized functions, as long as there is a single pragma to avoid it.

> : > I don't think the command should default to $_
> : Why?!
> Because $_ is primarily for the use of inner loops, not outer loops,
> and open tends to be in the outer loop rather than the inner loop.

As someone who tries to write clean code, I agree that the outer loop
should use a full name for the loop variable.

But as someone who writes oneliners every day, I disagree that any such
decision of how I should code should be made by the language designers.

$_ exists at many levels, and I frankly don't see a big problem with

    for @files { 
        open;
        say uc for =$_;
        close;
    }

(ignoring at this point that open accepts a list of handles. I'm sure
there are situations, especially in oneliners, where that isn't the best
solution.)
        
> And partly because of the mess in Perl 5 from 1-arg open, though
> that's probably irrational.

It is indeed.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to