in reply to Opinion: where Perl5 wasn't attractive for me

  1. I don't think I ever wanted such a thing
  2. So you'd rather have $array[i][j-1]? That would mean that whenever you need to copy the expression between inside and outside the square brackets, you'd have to add/remove $. No thanks!
  3. Backwards compatibility for use strict and you DO WANT those my()s.
  4. Sorry? I don't understand what do you want with the reverse. You can write $_ = shift; in main, but as @_ doesn't mean anything there, you get the next from @ARGV ... that is the script's parameters. Makes perfect sense.
  5. I'm inclined to agree here. I'm not so fond of dots though.
  6. You can: $i > 5 or do {print "No"; last}. It's better to use if(){} or unless(){}
  7. Within curlies, if it looks like a word, it's automatically quoted. It simplifies the code. I don't see how the magic of ++ hurts anything. What did you expect to get from $x = "a"; $x++?
  8. The parser is insanely complicated already, besides what would print 1 + foo(1+1)*2; mean then? Should the foo get 2 and then get its result multiplied by two or should the parser wait for the end of block or semicolon and pass 4 to foo? The rule that guides the first distinction is fairly simple ... If a subroutine name is followed by an opening brace, then its parameters end at the matching closing brace. If not THEN the parameters end at the semicolon or end of block. Keep in mind that print is just a function and it does return a value, even if that value is most often ignored. The filehandle stuff ... well, it's a bit tricky, but the rule above still holds. Don't expect special handling for print and you'll be fine.

Jenda
Enoch was right!
Enjoy the last years of Rome.

Replies are listed 'Best First'.
Re^2: Opinion: where Perl5 wasn't attractive for me
by rsFalse (Chaplain) on Nov 20, 2014 at 10:56 UTC
    Thank you all for interesting answers and discussion!

    >> So why do you complain that the following is onerous?
    I wrote that it seems to be basic (basic math function), so that means that it shouldn't introduce by POSIX. Basic math functions I keep: sqrt, abs, ceil/floor, round, (odd/even), sin/cos/tan/ctg, exp, some others. So I dislike Python no less.

    >> 2) chomp(@foo); is simpler than @foo = map chomp, @foo;.
    I meant "chomp(@foo)" - would do as it did. Only what it return differs. But then we couldn't get last character - that's also bad.

    >> Making an exception for length would be bad (very error prone).
    Why error-prone? ...And if you use text redactor, you always see "length" same color as other functions and non-barewords.

    >> So you'd rather have $array[i][j-1]?
    Yes, it would increase readability (if there are many indices, and nested). But sure, I can't suggest anything better.

    >> You can: $i > 5 or do {print "No"; last}.
    Thanks, I haven't used "... or do ...", but I can't understand why language has two different constructs ("{...}" with and without "do"), and I remembered strange thing about such blocks - that you can't use last (and friends) to escape unless you use {{double block}} (one more exception rule).

    >> What did you expect to get from $x = "a"; $x++?
    "b". I expect to get "a", if statement would be ($x++)--. I think that if Perl differentiates numerical and string operations writing them by punctuations and letters (e.g. firstly I started to use binary: cmp, le, eq, ne,... and <, =, >=, +, -,...), then it could use something different for string and numeral increment, for example: ++ for numeral, and "up" for string, -- for numeral, "dn"/"dw"/"down" for string.

    >> The parser is insanely complicated already, besides what would print 1 + foo(1+1)*2; mean then?
    It could be a rule of syntacsis, that function take ALL things till the closing paren (w/o opening paren) or thing that is less tight (or/and). So answer for example would be "print 1 + foo 4", and if we would like to have foo eaten only "(1+1)", then we should write "print 1 + (foo 1+1) * 2". With this rule we could everytime omit the outermost pair of parens.

      I agree that most of the stuff that's in POSIX should be either in the core or in some saner named modules. This module makes no sense whatsoever.

      The $array[i][j+1] looks good only as long as you use single letter indexes. What would $array[length] mean? $array[$length] or $array[length($_)]?

      Because one is block and the other is expression. Just use if(){}!

      Well, I would agree that if ++ is magical, -- should be as well. I do not see the need for a separate operator/function though.

      That would be way more confusing. If you write foo(...) anywhere within an expression, everyone except those coming from functional languages with support for currying will expect that function to receive as parameter(s) the stuff in braces and only that stuff in braces.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

        If you omit the sigil, there is also the ambiguity of whether you meant $array[$i] or $array[@i].

        Note: The array in scalar context gives the number of elements in the array. EG:$groupsOfSizeN[@group]++