Programming/Coding, Science

PHP 7: Scalar Type Declarations

One of the reason why PHP7 is actually a wall breaker of old PHP that leads to no more an ‘insane’ programming language for web development. Sure, the backward compatibilities and the baggage it brings are still there, but we need to understand that every language sucks for supports backward compatibilities.

It causes the designers/developers/community of the programming language generally enforce innovations much slower compared to others that are in their infancy or adoption phase. However, we cannot deny that backward compatibilities are also important for code reuse and that saves a lot of time and cost.

Old code works, so why reinvent the wheel? Anyway, what does this scalar type relates to backward compatibilities? Nothing, but it relates to the ecosystem of the PHP . Instead of redesign the whole language, the developers introduces several features for PHP 7that help the developers on programming a better quality with stricter typing features.

For anybody that tried Perl 6 and Golang gradual typing or Python’s type hints with mypy code analysis tool, you’ll find that PHP is not left behind as what the others has said about the language that they’ll probably use around last 14 years ago.


A quick look at Perl 6

Raku..Perl 6 is a “new ” programming language just finally released for stable version in the end of the year of 2015. You might be thinking that Perl 6 is the next version of Perl 5. However, it’s not. Perl 6 is totally different language than Perl 5.

The General Design

Perl 6 is a multi-paradigm language that supports object-oriented and functional programming as well. It also comes with gradual or optional typing like Go (means that you can switch between to explicitly declare the variable type in the program). As a bonus, Perl 6 made parallel and concurrent programming easier. Well of course, it’s equal if not better than Perl 5 for system administration tasks.

Why use Perl 6?

Due to its modern capability while maintaining the Perl philosophy much better than any other language, Perl 5 users will feel like at home, just not inside your own house, but inside your neighbor house. Yes, it’s relatively new language, has newer features compared to Perl 5. However, currently, it doesn’t have modules as much as Perl 5 modules in CPAN, but that will change, of course with the help of the community and its users.

So should I not use Perl 5?

No, you should keep continue to use Perl 5. Perl 5 and Perl 6 are different beasts. They might looked same, but they are not in the design perspective. Perl 5 is already time tested over 20 years, and has numerous libraries and tools to make it really useful for most things.


Perl 6 made easy for beginners to use, and we’re all beginners to Perl 6.