On 13 November 2010 13:57, Vincent Pit <perl@profvince.com> wrote:
>
>> I dont understand really why this needs new syntax. Why cant it be
>> done with a pragma.
>>
>> no autovivification 'lookup';
>>
>> something like that...
>>
>> yves
>
> autovivification already covers array and hash dereferencings with the
> 'fetch' category (which is enabled by default).
>
> As for method calls, it is currently invalid to dereference an undefined
> value returned from a method :
>
> $ perl -e 'sub new { bless [] } sub meth { my $undef }; my $x =
> main->new->meth->{foo}'
> Can't use an undefined value as a HASH reference at -e line 1.
>
> I think that's a bug in perl itself.
>
> As for function calls, I just believe it's a bad idea. It'd make
> effectively undef into a valid code reference.
Why is it ok for undef to be a valid package name but not a subroutine?
Other than that I like. And I would say *this* is something that is a
prime candidate for core inclusion instead of altering perl syntax.
Yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"
Thread Previous
|
Thread Next