Sunday, April 30, 2023

perl 5.36 vs tools

I'm finally looking at using 5.36 features in ports & packages.

Specifically, 5.36 brings signatures out of the "experimental phase".
(Detailed description is in perlsub(1)).

Prosaically, this brings perl from being a quirky language with weird
functions:

sub foo
{
my ($a, $b) = @_;

...
}


into something that looks more like usual programming languages:

sub foo($a, $b)
{
}


moreover, this does bring over argument number checking and easy optional
arguments.

(.e.g, stuff like unnamed parameters and optional parameters work more
or less like C++, and extra arguments can be stuffed into @l as usual.
For example:
sub foo($, $a, $b = 42, @l)

)

Of course, this also means some clean-up and internal documentation, because
there's lots of OO in there, and some methods have optional arguments which
weren't named until now, so this will take a bit of time and a few
experiments.

But I hope to make this code slightly easier to read for people who don't
know perl well.

No comments:

Post a Comment