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

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.

Replies are listed 'Best First'.
Re^3: Opinion: where Perl5 wasn't attractive for me
by Jenda (Abbot) on Nov 20, 2014 at 16:03 UTC

    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]++