in reply to What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff

1: Auto-semicolons are bad. Look at Javascript. Who deliberately uses them? Nobody. Who occasionally needs to workaround them? Everybody.

2: Runaway quotes are usually caught anyway; it's just the error message happens several lines further than you expect it to be. For a missing quote mark not to cause a syntax error requires a perfect storm of conditions. (Usually involving quote marks being used in comments.) To anybody using editors with syntax highlighting, this isn't usually much of an issue anyway. I don't think it's necessarily a bad idea, as long as heredocs are exempt. I just don't think it gives us much.

3a: I see no use for this feature. What would it be used for?

3b: It's already possible to close multiple levels of braces on one line. The syntax for it is: }}. You even have fine-grained control over how many levels you close. If you want to close four levels, use }}}}. If you're closing less than four levels, this existing syntax is as compact or more compact than what you suggest. If you're routinely closing more than four levels, consider restructuring your code so it doesn't have so many deeply nested blocks.

4a: The frequently used built-ins mostly have pretty short names anyway. Any shorter and they lose descriptiveness. I don't see how this is a win.

4b: I don't know exactly what you mean.

4c: I really need to fix up my macros implementation and put it on CPAN.

5a: I guess this is a decent one.

5b: By translation table, you mean tr///? Seems like overkill.

5c/5d: head, tail, trim, ltrim, and rtrim are so trivial to implement, I don't see the need for them to be in core. There's a bunch of implementations on CPAN already.

6: for what purpose?

7: global variables are design smell. "Let's introduce new features for global variables" is like saying "let's make the two-argument open more powerful".

8a: It's not hard to check if the return value of index is below a certain limit.

8b: Don't the existing substr and splice functions do this?

9a: Umm, when is already allowed in for loops.

9b: I don't understand what's made easier by this.

  • Comment on Re: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
by likbez (Sexton) on Sep 13, 2020 at 19:20 UTC
    Thank you for reviewing all the proposals. Instead of just "soft semicolon" :-)
    5a: I guess this is a decent one.
    Some progress :-).
    8a: It's not hard to check if the return value of index is below a certain limit.
    No. For example, in bioinformatics FASTA sequences the string can be several gigabytes. You need to use substr right now to limit the search area.
    9a: Umm, when is already allowed in for loops.
    There are a couple of unresolved problems. You need to suppress "when is experimental" warning to use it with

    no warnings 'experimental::smartmatch';

    and the form when('a') involves smart matching as as such might not work in future releases. So it is essential to disable smart matching in when in order to use it (in this case the syntax should be when( $_ eq 'a')... and the form when('a') should generate an error, which I do not think is currently possible.

      You need to suppress "when is experimental" warning to use it

      No, you don't. It will quite happily work without suppressing the warnings, you just get the warnings is all. And that's a good thing because it means that you don't forget that it's experimental.


      🦛