Why forward compatibility is important when trying to add a new grammar to Perl

There is a lot of discussion about adding a new grammar to Perl.

Most of the time, because the issues are not shared, my opinion is a minority in that place.

When you try to add a new grammar to Perl, it is goot to think why forward compatibility is important.

What is forward compatibility?

you've heard of the term backward compatibility, but many people don't yet hear the term forward compatibility.

Forward compatibility means that new features in Perl are compatible with older versions of Perl.

This means that forward-compatible features can work with the latest grammar with the help of modules, even if the Perl is the old Perl 5.8.7.

If the new grammar has forward compatibility, you can use the grammar in the most CPAN module

I have subroutine signature 2019 In the article, I wrote about forward compatibility.

If the signatures module is forward compatible with signatures that have been experimentally added to Perl, CPAN authors can use the signatures in Perl 5.8.7 by making them dependent on the signatures module.

If a forward-compatible signature is implemented in Perl 5.3x, make it dependent on the signatures module so that it does not depend on anything in the new version of Perl, but on older versions of Perl. , You can use the signature grammar.

This is a big advantage. This is because the CPAN module and application code can use the same codes.

Taking Mojolicious as an example, not only the application code but also all code on the Mojolicious modules can be rewritten with a signature description.

2 Comments

This is not exactly what forward compatibility means. It means designing the system to recognize features that it does not implement, so it still works as well as it used to, but it does not mean that the new features will work. Perl is very forward compatible but it's because we do not change any defaults: any new features are enabled by feature flags or modules, so old Perls will either run the code the same way or fail in an obvious way because they don't implement a needed feature.

Leave a comment

About Yuki Kimoto

user-pic I'm Perl Programmer. I LOVE Perl. I want to contribute Perl community and Perl users.