Hacker News new | past | comments | ask | show | jobs | submit login

> early Perl was missing little things like named function arguments

It's still missing those :)

(To be clear for people unfamiliar with Perl, it probably will never have them, because it doesn't need them. In Perl, all functions effectively have a single parameter of array type. The standard convention is to assign each array entry to a variable at the start of your function definition, and the names of those variables then effectively act as parameter names. But that's just a convention and you can do something else if you want.)




I know cygx already replied, but to be clear, function signatures have been available in Perl since 2015. They were added (as experimental) in 5.20, and are now enabled by default with `use v5.36` or later.

All new features must now go through an experimental phase after the smartmatch debacle. Signatures stayed in experimental status a little longer than most new features due to an unfortunate change with respect the order of function signatures and function prototypes. Provided you weren't using prototypes (which you almost never need) then they've been largely stable since 2015.

Most distro's under current support ship with at least Perl 5.24, so you can use them almost anywhere.


Nowadays, sub signatures can be enabled via

    use feature 'signatures'
which is implied by

    use v5.36




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: