in reply to Java accepts Perl leadership
Actually, this exact functionality is not suported by Perl, except for internal containers (ie, straight hashes and arrays, or tie'd versions thereof). I mean, this code:
my $container = Container->new(qw(e1 e2 e3)); foreach ($container) { # now $_ is $container, NOT one of the elements in it }
Is not equivalent to:
While in java 1.5 you CAN switch the container between a "full-blown" container object and a "basic" array.my @container = qw(e1 e2 e3); foreach (@container) { # now $_ iterates over the elements of @container }
The only remarkable thing about the implementation of this feature in Java, is that it wasn't there in Java 1.0 (probably because the standard container interfaces weren't introduced until 1.2 or thereabouts - big oversight by Sun, if you ask me).
Anyway, I don't think the introduction of a foreach-like construct in Java kan be considered an "acceptance of Perl leadership" whatever that means.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Java accepts Perl leadership
by broquaint (Abbot) on Jun 28, 2004 at 04:33 UTC |