in reply to Re^2: closure clarity, please
in thread closure clarity, please

You're talking of the scope of the variables now, not the scope of the sub. Yes, they are visible to the sub. We gave a number of examples of this. You can't have closures without this.

No, I don't think I am. It matters where the sub is defined. Saying that a sub is global, end of discussion is not at all helpful in determining what variables a sub can see. Clearly, it matters where a sub is defined in determining what values it can see.

A sub defined outside any blocks cannot see a my variable declared inside a block, yet if the sub is defined inside the block, it can see the my variable. The scope of the my variable is the same in both cases. I don't see how saying that the scope of a variable is "wherever it can be seen" is of any use. The goal is to determine where a variable can be seen.

Replies are listed 'Best First'.
Re^4: closure clarity, please
by ikegami (Patriarch) on Nov 27, 2009 at 03:14 UTC

    No I'm not [talking of the scope of the variables now]

    The visibility of the variables is the scope of the variables. You were saying that the sub can see the variables. That's means the sub is within the scope of the variables.

    It matters where the sub is defined, which you keep saying doesn't matter,

    It does matter, I've said as much, and I've never said otherwise.

    If the sub's definition was moved outside of the scope of the vars, the sub wouldn't be able to see the vars. I've given an example of this.

    Saying that a sub is global, end of discussion is not at all helpful in determining what variables a sub can see

    I agree. I never said it was.

    By the way, you can ding my reputation all you want.

    "You" must be a reference to someone else. I haven't downvoted any of your nodes, in any thread. I've had no problem with your questions. You are putting effort. You are learning.

    Mind you, I haven't upvoted many of your nodes either. I always forget to vote.