Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Perl6: Smart match CAN'T BE that smart

Name: Anus 2011-10-12 11:03

Hi /fags/

From: http://perlgeek.de/blog-en/perl-6/three-functions-of-smartmatch.writeback



In Perl 5, if you want to match a regex against a particular string, you write $string =~ $regex.

In the design process of Perl 6, people have realized that you cannot only match against regexes, but lots of other things can act as patterns too: types (checking type conformance), numbers, strings, junctions (composites of values), subroutine signatures and so on. So smart matching was born, and it's now written as $topic ~~ $pattern. Being a general comparison mechanism is the first function of the smart match operator.


If you keep reading, you will see that they found this operator to be rather problematic... I would like to know y'oure opinion.

Personally, I would have prefered to go the Perl5 way: =~

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List