I think making things optional, and coding for fun is one of the things
that define Perl as a language.
For instance Perl let's function calls omit parentheses where other
languages such as C might be strict about.
I'm not against "and", just wouldn't prefer it, but someone else may of
course, that's why it's being used and suggested in some docs.
Making if parens optional means you can use them if you want, while I may
omit them if I like it this way. So it's a win-win situation. If you'd like
to be strict, then you can create and enforce a policy on coding style
instead.
On Wed, Feb 21, 2024, 5:12?PM <perl5@tux.freedom.nl> wrote:
> On Wed, 21 Feb 2024 16:09:54 +0100, Elvin Aslanov <rwp.primary@gmail.com>
> wrote:
>
> > > $a < $b and action ();
> >
> > I don't like this syntax. I always try converting this to regular if's
> > whenever possible.
>
> This is why perl is perl and not raku or go or java or whatever
> This is also why *I* love perl: you can write code the way *you* like
> it best and how it best reflects your line of thinking. There is no
> rule to the language to tell you one is better than the other.
>
> I really hate
>
> $a = 42 if $b < $a;
>
> and will rewrite that to
>
> $b < $a and $a = 42;
>
> whenever I will be the only maintainer of that code.
>
> > I think whatever could be optional should be optional :-)
>
> I do not see the relation to the code being discussed
> Currently parens are not optional and I think they won't be optional in
>
> if ($b < $a) { $a = 42; }
>
> if you don't want parens, write either one of the two examples above
>
> > I enjoy seeing the lack of parens when I check Raku and Go code.
>
> Then use that when coding for fun.
>
> > That's just my personal thoughts as a user.
> >
> > On Mon, Feb 19, 2024 at 8:32?AM <perl5@tux.freedom.nl> wrote:
> >
> > > On Sun, 18 Feb 2024 16:32:36 +0100, Elvin Aslanov <
> rwp.primary@gmail.com>
> > > wrote:
> > >
> > > > That's a good idea, I was also thinking about that, Raku and Go
> already
> > > > allow this syntax.
> > >
> > > Raku and go are not perl. I think it is a bad idea.
> > >
> > > I also do some raku and I always use parens. Readability and
> > > consistency matter and it makes it easier for me to keep the perl- and
> > > raku versions of the same module in sync.
> > >
> > > > It might be difficult to implement but it will definitely make coding
> > > > easier and prettier.
> > >
> > > Both of the opinions are not facts but the eye of the beholder
> > >
> > > Easier: not if the rest of the code does not follow the newer syntax
> > > not if the rest of the team does not like it
> > > not if your code has to support 20 year old perl
> > > ...
> > >
> > > Prettier: not if you like consistency
> > > not if you like parens
> > >
> > > Personally I do like the parens in
> > >
> > > if ($a < $b) { action (); }
> > >
> > > if I do not want them
> > >
> > > $a < $b and action ();
> > > or
> > > action () if $a < $b;
> > >
> > > I've seen way to many people say something is "easier" just because
> > > *they* *like* it, but even if you do *not* like it, *ALL* code is
> > > easier to parse when the indent, style and use if syntax and variable
> > > names is *consistent*.
>
> --
> H.Merijn Brand https://tux.nl Perl Monger http://amsterdam.pm.org/
> using perl5.00307 .. 5.37 porting perl5 on HP-UX, AIX, and Linux
> https://tux.nl/email.html http://qa.perl.org https://www.test-smoke.org
>
>