Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: Re: Re: Re: Re: Surpised by foreach iterator limitation

by MarkM (Curate)
on Apr 08, 2003 at 03:38 UTC ( [id://248801]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Re: Surpised by foreach iterator limitation
in thread Surpised by foreach iterator limitation

Wrong how? By suggesting that foreach() could work if suitably innovated? I don't see how this could be wrong. You are looking at the current implementation of foreach() and local() and declaring it impossible, unfeasible, or wrong. If everybody looked at Perl this way, there would be no Perl 6, let alone Perl 2.

Please note that I didn't say the patch would be less than 100 lines long. Perl's evolution is entirely based on this sort of principle. People expecting something to 'just work'. It doesn't. People fix it so that it does. This is Perl. You should be familiar with this by now. :-)

You seem to be stuck on the definition of 'variable'. Where you and the original poster differ is that you don't see a[5] as a variable. I and the original poster *do* consider a[5] to be a variable. Fine, it doesn't have a simple name, but then, who cares about simple names? Your example showing that local() has a wider scope is wrong, since I am sure you should realize that:

package main; local $b = 2; $main::b = 3; print "$b\n"; # prints "3\n"

Meaning, that '$b' is really just ${$main::{'b'}}, which is just as much a 'variable' or not a 'variable' as $a[5] is.

I think I've made my case... :-)

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Re: Surpised by foreach iterator limitation
by pg (Canon) on Apr 08, 2003 at 03:48 UTC
    No, I am not looking at the current implementation of Perl. I am looking at a very fundamental principle of the syntax for computer language:

    Any syntax should have a consistent meaning/interpretation, and can be consistently recognized by computer as a presentation of the same existance.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-03-29 06:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found