Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smatchmatch against Pair not smart enough? #64

Open
Mouq opened this issue Apr 27, 2014 · 1 comment
Open

Smatchmatch against Pair not smart enough? #64

Mouq opened this issue Apr 27, 2014 · 1 comment

Comments

@Mouq
Copy link
Contributor

Mouq commented Apr 27, 2014

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

@moritz
Copy link
Contributor

moritz commented Apr 28, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants