How does object orientation in Perl 6 differ from Perl 5?
Perl 6 makes vast improvements over Perl 5 when it comes to object oriented programming. The main differences are: • The “->” for method calling and attribute access has been replaced with “.” (as used in Java, C# and many other languages) • A new opaque type has been added so real encapsulation is trivial • The “class” keyword has been introduced to distinguish real classes that can be instantiated from modules of subroutines. If you are familiar with Perl 5, a consequence of this is that you will no longer have to write your own constructor that blesses a hash and so on. • The “has” keyword has been introduced for specifying attributes rather than just storing them in a hash or array (thus giving much better compile time checking) • The “method” keyword has been introduced to indicate that something is really a method, not just a subroutine. • The introduction of roles to aid code re-use. In Perl 6, classes are primarily for instance management rather than code re-use. Many object or