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
ref should trigger warnings and doc needs work #17159
Comments
From rirans@comcast.netCreated by rirans@comcast.netThis is a bug report for perl from rirans@comcast.net, ----------------------------------------------------------------- Thanks again for a great product! $ perldoc -f ref Instead, use "blessed" (in the Scalar::Util module) for boolean Reading this I think ref should warn 'deprecated'. Ref should warn 'imprecision' on any blessed object. At best, it seems that ref should only be used when dealing with But beyond clarifying this language, a clear "Using ref is now Note also that the reference to Scalar::Util::reftype is damaged by $ perldoc perlobj The section "bless", "blessed", and "ref" also lacks any mention of danger. rir Perl Info
|
From @GrinnzOn Thu, 26 Sep 2019 18:20:45 -0700, rirans@comcast.net wrote:
I disagree with this assessment. ref is a highly useful lightweight function for distinguishing between a reference and a non-reference, or determining the reference type when you are already sure the reference is not blessed, or if you are willing to live with breakage when someone decided a class named ARRAY was a good idea. The caveat that it may also return a class name sometimes, is unimportant for a large percentage of use cases. reftype is in fact not useful for blessed references either, because a blessed reference should only be used via its documented interface (which may include internals or overloads, but usually doesn't). If you want to account for blessed references, you should always start with Scalar::Util::blessed.
This could be reported or patched in Scalar::Util which is maintained on CPAN. And yes, they do refer to the same types. -Dan |
The RT System itself - Status changed from 'new' to 'open' |
From @GrinnzOn Thu, 26 Sep 2019 18:20:45 -0700, rirans@comcast.net wrote:
Note this documentation is out of date; the latest version can be viewed at https://perldoc.pl/functions/ref . -Dan |
Migrated from rt.perl.org#134452 (status was 'open')
Searchable as RT134452$
The text was updated successfully, but these errors were encountered: