3 ms·
> Python can let objects be used as keys in dictionaries. In Perl 6 object hashes allow you to do the same (https://docs.perl6.org/language/hashmap#index-entry
by lizmat 8y ago
> Python can let objects be used as keys in dictionaries.
In Perl 6 object hashes allow you to do the same (https://docs.perl6.org/language/hashmap#index-entry-object_hash https://docs.perl6.org/language/hashmap#index-entry-object_h...). If you're only interested in checking for existence, you can use a Set (https://docs.perl6.org/type/Set https://docs.perl6.org/type/Set). If you want to just count the number of occurrences, you can use a Bag (https://docs.perl6.org/type/Bag https://docs.perl6.org/type/Bag).
> Perl's optional variable declarations catch a lot of minor bugs.
In Perl 6, variable declarations are obligatory by default.
> Python's iterators/generators take a lot of work to replicate in Perl.
In Perl 6 there is an easy to use interface for creating iterators (https://docs.perl6.org/type/Iterator https://docs.perl6.org/type/Iterator)
All of these features are built-in, so no module loading is necessary.
- btilly 8y agoI do not think of Perl 6 as Perl, despite the naming and people involved. I believe that it is as easy to migrate from Perl 5 to another scripting language as it is to migrate to Perl 6. Furthermore the last I heard, Perl 6 performance was a disaster story. And libraries + real world adoption is kinda thin on the ground. Therefore other scripting languages (particularly JavaScript and Python) are more compelling targets to migrate to. Has this picture brightened in the last year or so?
- lizmat 8y agoI would say so, yes. For instance, basic object creation in Perl 6 is now faster than basic object creation in Perl 5. Both can be improved with some tricks that experienced developers know, such as not using accessors in Perl 5, but directly lookup keys in the underlying hash. Similarly in Perl 6 some tricks can be performed. And then still Perl 6 is faster. Introducing Moo or Moose on the Perl 6 side, will only make Perl 5 slower. Making things faster in Perl 6 has been the main focus of development in the past 3 years. See also our most recent teaser for the 6.d release: https://i.redd.it/et514ut106u11.jpg https://i.redd.it/et514ut106u11.jpg which shows that the use of set operators has become almost 50x faster in that period.
- Grinnz 8y ago> I do not think of Perl 6 as Perl, despite the naming and people involved. I believe that it is as easy to migrate from Perl 5 to another scripting language as it is to migrate to Perl 6. These beliefs are shared by most users of both languages, which makes bringing up Perl 6's capabilities in a Perl vs Python discussion confusing.