Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: use has it's own scope?

by chromatic (Archbishop)
on Aug 08, 2017 at 15:52 UTC ( [id://1197004]=note: print w/replies, xml ) Need Help??


in reply to Re^4: use has it's own scope?
in thread use has it's own scope?

Arguably it should be disallowed

Why? LIST here is the standard argument passing mechanism. Making an exception for a my expression in an argument list or making an exception for expressions in import lists would be complicated and break symmetry of syntax, semantics, and implementation.

This is the piece that sundial's missing. It's a confusing combination of existing Perl behavior because it's uncommon and relatively useless, but it's valid syntax because of the way Perl works.

Replies are listed 'Best First'.
Re^6: use has it's own scope?
by Anonymous Monk on Aug 08, 2017 at 16:39 UTC

    Actually, I agree with you -- I didn't say I would be the one to make that argument ;-)

    Maybe I should have suggested that it could arguably be a warning. Perl warns on all kinds of things that are valid but "potentially confusing," and there seems to be a fair amount of back-and-forth about what those things are.

      Yeah, I see the argument for making it a warning.

      Detecting this case is complicated, though. Unlike pseudo-state variables, it's not a shaky part of syntax and composition and implementation. At best, you might be able to express that a lexical variable appears to be used only once, but I can still imagine a bizarre module interface which closes over the using scope's lexical.

        I can still imagine a bizarre module interface which closes over the using scope's lexical

        I can, too; but I tried, and I don't think it can be done -- at least not without resorting to something in the B namespace. You could probably do it, though. ;-)

        I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1197004]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-16 17:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found