perl5
perl5 copied to clipboard
Allow ${0x10}, ${0b10000} and ${0o20} to be used as aliases for $16 under use strict.
This PR assumes that the commit in #20000 will be merged and includes it for now.
Treat ${0x10} as $16 and allowed under strict, similarly ${0b10000} and ${0o20}. Without strict they would resolve to $16 as well, but would be treated as symbolic references. Since they are constants and since "all digits vars always exist", it doesn't seem necessary to treat them as symbolic references and forbid this usage under use strict.
Personally I don't know if I like this/if this change is a good idea;
As noted: $0xA isn't a valid variable but $::0xA is.
Right now: using ${0xA} triggers an error under use strict;
after this PR it no longer will.
But the real question is what did the user intend?
If someone is using $::0xA as var (which I consider a bad idea) then they might expect that ${0xA}[^1] resolves to the same var. (It doesn't(/never did) but at least before this PR use strict will complain where as now it might (silently) do the wrong things).
[^1]: in package main
On Mon, 1 Aug 2022 at 15:56, Bram @.***> wrote:
Personally I don't know if I like this/if this change is a good idea;
As noted: $0xA isn't a valid variable but $::0xA is. Right now: using ${0xA} triggers an error under use strict; after this PR it no longer will.
But the real question is what did the user intend? If someone is using $::0xA as var (which I consider a bad idea) then they might expect that ${0xA}1 <#m_-7528345075786139255_user-content-fn-1-b3720c9c0a55e89bd8dcee6d67c21772> resolves to the same var. (It doesn't(/never did) but at least before this PR use strict will complain where as now it might (silently) do the wrong things). Footnotes
in package main ↩ <#m_-7528345075786139255_user-content-fnref-1-b3720c9c0a55e89bd8dcee6d67c21772>
— Reply to this email directly, view it on GitHub https://github.com/Perl/perl5/pull/20014#issuecomment-1201241223, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAZ5R6CTUYC73RDUS5UI5LVW7JSRANCNFSM55BAYNZQ . You are receiving this because you authored the thread.
Yeah, I think you have convinced me. It was a nice way to prove to myself I understood what S_scan_ident() was doing but it is not really necessary and maybe it would open a can of worms that we dont need to open. I'll leave it open for a few days to see if anyone says "god yes please" so you and they can debate it out, but if nobody replies in a few days i'll close it.
BTW, regardless I do appreciate the feedback you have given on this, its been helpful to push me to learn some esoterica I hadnt needed to learn yet. :-) I hope it hasn't consumed too much of your time.
cheers, Yves
-- perl -Mre=debug -e "/just|another|perl|hacker/"
On second thought... Lets not.