You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently S03 says about smartmatching against pairs: Any Pair test object attribute ?."{X.key}" === ?X.value (e.g. filetests)
The primary value of this is for things like $file-path ~~ :e, which tests for the existence of a file, and $file-path ~~ :!e, which tests for the non-existence of a file.
It seems strange that Perl 6 forces a boolean comparison to the value. Wouldn't it be more consistent for the rule to be: Any Pair test object attribute ."{X.key}"() ~~ X.value
Note that $anything ~~ True is True, so your proposal would imply :!e ~~ :e, which isn't very intuitive. On the flip side, $anything ~ False is false, so $anything ~~ :!e would always return False.
IMHO the right thing to do is to abolish the ~~ :e notation for file testing; methods work well enough.
Currently S03 says about smartmatching against pairs:
Any Pair test object attribute ?."{X.key}" === ?X.value (e.g. filetests)
The primary value of this is for things like
$file-path ~~ :e
, which tests for the existence of a file, and$file-path ~~ :!e
, which tests for the non-existence of a file.It seems strange that Perl 6 forces a boolean comparison to the value. Wouldn't it be more consistent for the rule to be:
Any Pair test object attribute ."{X.key}"() ~~ X.value
IRC conversation here: http://irclog.perlgeek.de/perl6/2014-04-27#i_8644524
The text was updated successfully, but these errors were encountered: