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

Smartmatch with S/// Warning Inaccurate / Misleading #5273

Closed
p6rt opened this issue Apr 28, 2016 · 4 comments
Closed

Smartmatch with S/// Warning Inaccurate / Misleading #5273

p6rt opened this issue Apr 28, 2016 · 4 comments
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Apr 28, 2016

Migrated from rt.perl.org#128019 (status was 'resolved')

Searchable as RT128019$

@p6rt
Copy link
Author

p6rt commented Apr 28, 2016

From @zoffixznet

Trying to smartmatch against S/// gives a compile time warning​:

  'Smartmatch with S/// can never succeed because the string it returns will fail to match' [...]

First, that warning is inaccurate, because if S/// doesn't match the string, it'll return the original string, which will smartmatch as True.

Also, the second part of the error is misleading​:

  [...] 'You can use given instead of ~~.'

It's perfectly understandable if a new Perl 6 programmer will take that to mean "change ~~ to `given`". And if they do so, they'll get another confusing (to a beginner) error, since there's no .match method in their code​:

  Method 'match' not found for invocant of class 'Any'

Thus, I propose the error message to be changed to the following​:

  'Smartmatch with S/// is not useful. You can use given instead​: S/// given $foo'

@p6rt
Copy link
Author

p6rt commented Jun 18, 2016

From @zoffixznet

PR to resolve this​: rakudo/rakudo#789

@p6rt
Copy link
Author

p6rt commented Jun 18, 2016

From @zoffixznet

Resolved in commit rakudo/rakudo@449a2e7

@p6rt
Copy link
Author

p6rt commented Jun 18, 2016

@zoffixznet - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Jun 18, 2016
@p6rt p6rt added the LTA Less Than Awesome; typically an error message that could be better label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant