3 ms·
I haven't been using Perl 6 lately, but, as of a few years ago when I did, some of the more notably unusual features or planned features were: * Grapheme-level
by ekiru 11y ago
I haven't been using Perl 6 lately, but, as of a few years ago when I did, some of the more notably unusual features or planned features were:
* Grapheme-level string processing, even when there's no pre-composed Unicode codepoint for the grapheme. I think Swift is now doing this, too, but I'm not sure if anyone else is.
* Perl 6's grammars are to an extension of parsing expression grammars what the regular expressions in Perl 5/Ruby/JavaScript/etc. are to an extension of regular expressions. One can use PEGs (or other grammar formalisms) in any language with a library or code generator, but, with a few exceptions like Parsec, it's usually not nearly as convenient.
* Roles, similar to the traits concept developed by Nathanael Schärli, Stéphane Ducasse, Oscar Nierstrasz, and Andrew P. Black (and present under that name in e.g. Squeak Smalltalk and PHP since 5.4). Roles/traits are similar to mixin-style multiple inheritance, except that, when including multiple traits with conflicting methods, the including class must explicitly resolve the conflict. Mixin-style systems use an implicit linearized method-resolution order, which is more fragile because newly added methods in earlier mixins can silently override methods of the same name from another mixin that the caller was actually intending to call.
* Multiple dispatch is not unique to Perl 6, but it's not especially common, and it's very convenient.
* Configurable object representations. For example, a class can be defined to use the default P6opaque representation, which is I think usually implemented as a pretty standard struct-like representation with properties at fixed offsets. Other possibilities might be a hash table representation, where an object is represented by a hash table and attribute access is done by accessing the values of appropriate keys in the hash table. If one wants to forgo the optimizations allowed by fixed representations, one can even define a class with `is repr(*)` to allow individual objects of the class to be created with different representations.