David L. Nicol writes:
: Larry Wall wrote:
:
: > Syntactically speaking it's too ambiguous to have both a unary < and a
: > bracketing <>.
:
: Cool. Do we get a > operator to use as an l-value, instead of print?
:
: >$log = join localtime, 'difficult cramigudgeo';
I don't think so.
: > It's possible we're thinking of iterators wrong here. Perhaps
: > iterators should typically be stored in @iter, not $iter. Then it's
: > pretty obvious that
: >
: > for (@cases) { }
: >
: > iterates, because it's in a list context.
:
: but it is not obvious that @cases is an iterator.
Except insofar as all arrays are iterators of some sort or other, and
can produce a list in a list context. All lists are created equal,
but some are more equal than others.
: Unfortunately we don't
: have an infinite supply of line-noise to arbitrarily extend this optimized
: hungarian notation ($@%&)
Don't see the need yet. English gets by with $singular and @plural,
and a bit of leftover %dual from Indo-European days. It's pretty
obvious in English from context when you say "miles to go before I
sleep" that the miles come one at a time. It's a kind of iterator. On
the other hand, with "a can of worms", you usually consider that you
get all the worms at once.
: for C<for ($cases){...}> to do anything interesting, there's something
: special about $cases, making iterator-in-scalar more visible than
: iterator-in-array,
: where it could easily be mistaken for a container instead of a generator.
:
:
: > I think iterator magic
: > always works in list context, and never in scalar.
:
: okay, that disambiguates copy and retrieve handily, guess I'll delete the
: five unsent e-mails eulogizing <angles> now
Well, I was speaking of iterators in @worms, not $worms. I still don't
think $worms should do anything special in list context. Maybe $STDIN
should really be spelled @STDIN. Perhaps iterators really want to
implement a form of highlander variable:
my @worms is alias($worms) tie(Iterator);
or
my $@worms; # highlander declaration
Just shooting my mouth off here, if not my foot...
A argument could also be made that iterators are neither scalars nor
arrays--they're functions.
Doubtless Damian could come up with a way to view them as hashes...
Well, hey, at least we'll all go mad together.
Larry