develooper Front page | perl.perl5.porters | Postings from July 2021

Re: Two further features, one definitely needed for survival, otherlikely needed.

Thread Previous | Thread Next
From:
Philip R Brenan
Date:
July 4, 2021 17:18
Subject:
Re: Two further features, one definitely needed for survival, otherlikely needed.
Message ID:
CALhwFRnELvmp-YMU5+mK3sdNwxa-4MqHVHwhTFtThbzo=1+1Vw@mail.gmail.com
   no sigils;
   x = (0, 0);
   y = 1;
   z = (x, y);  # z is (0, 0, 1)

Your sigil free version is much easier to understand!


On Sun, Jul 4, 2021 at 2:23 PM John Ankarström <john@ankarstrom.se> wrote:

> Den 2021-05-23 kl. 21:33 skrev L A Walsh:
> > 2) Going 'unnecessary-sigil' optional.
>
> You've clearly put some thought into this, and there's nothing on face
> value that I would regard as impossible in your proposal.
>
> That said, I don't see it ever being enabled by default in any version
> of Perl for a couple of reasons:
>
>    1. It feels "unperlish".
>
>    2. It seems to admit that sigils were a bad idea from the beginning.
>  I don't think everyone agrees about that.  I don't think I personally do.
>
>    3. Many parts of Perl have been designed with the assumption that
> variables have sigils.  For example, let's assume that Perl never had
> sigils.  If that had been the case, I would doubt that lists would act
> the way they do in Perl.
>
> This
>
>    x = (0, 0);
>    y = 1;
>    z = (x, y);  # z is (0, 0, 1)
>
> just doesn't seem intuitive to me, and I suspect that it would trip up
> most people, just like the UNIX shell's word splitting does.
>
> Once you add sigils, however:
>
>    @x = (0, 0);
>    $y = 1;
>    @z = (@x, $y);  # @z is (0, 0, 1)
>
> ... the intention is much more clear and the automatic list flattening
> is no longer a foot gun; instead, it becomes a very useful feature.
>
> In summary, sigils likely make a lot of useful Perl syntax possible --
> syntax that would be hard to remove from Perl without transforming it
> into an entirely different language.
>
>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About