Perhaps not having strict and warnings on by default in programs (that is, everything except for one-liners) counts.
| [reply] |
Can you give an example of "worse-is-better" in the design of Perl before Perl 6?
Not that I can speak for Larry, but I'd see Perl 5's OO model as an example of worse is better backfiring. While it was an elegant and simple way to shim OO into Perl 4 with the minimal of additional baggage, it made other stuff tricky in the longer term.
| [reply] |
Will we have lvalue methods in Perl 6? Because that's what really bugs me, about Perl 5 OO.
$obj->SetProperty("something");
is just ugly, compared to the shiny elegance of
$obj->Property = "something";
| [reply] [d/l] [select] |
You bet you will have them! Only such a method will be spelled 'is rw'. Well, until Larry changes his mind on this...
| [reply] [d/l] |
use v6;
class test {
has $.Property;
}
my $testing = new test;
$testing.Property = 5;
$testing.Property.say;
I beleive that it actualy uses a Proxy object with lvalue attributes, but don't quote me on that. ;)
| [reply] [d/l] |
package Foo;
sub foo : lvalue {
my $self = shift;
warn "Only first argument to method foo is used" if @_ > 1;
$self->{ foo } = shift if @_;
$self->{ foo };
}
my $x = bless +{}, 'Foo';
$x->foo = 3;
print $x->foo, "\n";
$x->foo++;
print $x->foo, "\n";
$x->foo += 6;
print $x->foo, "\n";
__END__
3
4
10
I know that user-defined functions with the lvalue attribute, in general, will give wrong results in the debugger, but that's only a problem for those weenies who use the debugger ;-) (Plus, there are good ways around this.)
| [reply] [d/l] |