Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Yes, I hear this suggestion a great deal. In fact, I've been hearing it for 20 years now...and mostly against Perl 5 itself:

Damian (in early 1995), commenting on a Perl 4 solution:
Of course, nowadays I'd write it in Perl 5.0, taking advantage of references, lexical variables, object-orientation, ties, autoloading, threads, better regexes, and modules.
Anonymous Perl 4 user:
Maybe we should be spending our time deciding what to call "Perl 5," since it obviously isn't "Perl." At best, it's a language that adopted a few keywords, like local and do, but it bears no resemblance (nor compatibility) at all to its erstwhile namesake.
.
.
.
Damian (in early 2014), commenting on a Perl 5.8 solution:
Of course, nowadays I'd write it in Perl 5.20, taking advantage of defined-or, switches, object filehandles, smartmatching, state variables, postfix dereferences, subroutine parameter lists, lexical subroutines, named captures, independent subpatterns, C3 method resolution, and autodie.
Anonymous Perl 5.8 user:
Maybe we should be spending our time deciding what to call "Perl 5.20," since it obviously isn't "Perl." At best, it's a language that adopted a few keywords, like my and use, but it bears no resemblance (nor compatibility) at all to its erstwhile namesake.

It's almost as if some people feel that the motto "There's more than one way to do it" applies to everything about Perl...except Perl itself.

But, in my opinion, "Perlishness" isn't really about syntax, or semantics, or even features. It's about the belief that programming languages should be designed to be flexible and powerful, and should come with all the useful tools and data structures built in, and should make easy things easy and hard things possible, and should do so without getting in your way. And by every one of those measures, Perl 6 is arguably more Perlish than Perl 5.

And as for "no resemblance (nor compatibility) at all to its erstwhile namesake", remember that I deliberately chose a Perl 6 approach that emphasized that language's many new features. The following is also a pure Perl 6 version of "bottles of beer":

my @bottles_of_beer = map {join "", "$_ bottle", $_ ne 1 && 's' || '', " of beer"}, 'No', 1..99; my $n = 99; while ($n > 0) { say "@bottles_of_beer[$n] on the wall,\n", "@bottles_of_beer[$n].\n", "Take one down, pass it around,\n", "@bottles_of_beer[--$n] on the wall.\n"; }

I think you'd have to concede that this version bears at least some resemblance to (and compatibility with) Perl 5, given that it differs from being executable Perl 5 by exactly one character.

Or I could have written my Perl 6 version "bottles of beer" like this:

sub bottles { my ($n) = @_; return "No bottles" if $n == 0; return "1 bottle" if $n == 1; return "$n bottles"; } for (reverse 1..99) { say bottles($_), " of beer on the wall,"; say bottles($_), " of beer."; say "Take one down, pass it around:"; say bottles($_ - 1), " of beer on the wall."; say ""; }

...which is executable Perl 6 and also executable Perl 5.

So, sure, when I use just the new features of Perl 6, it seems like a language entirely different from Perl 5. But that's just as true when I use the new features of Perl 5.20 and it seems like an entirely different language to Perl 5.8. Or when I use the new features of Perl 5.8 and it seems like an entirely different language to Perl 4. That's just the nature of all programming language development.

Damian


In reply to Re^4: too much free time by TheDamian
in thread too much free time by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2021-06-14 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (62 votes). Check out past polls.

    Notices?