develooper Front page | perl.perl5.porters | Postings from September 2000

Re: Perl5.7.0 "overload" of %{}

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
September 2, 2000 09:35
Subject:
Re: Perl5.7.0 "overload" of %{}
Message ID:
E13VFyJ-0001Ce-00@roam1
Jarkko Hietaniemi <jhi@iki.fi> writes:
>On Sat, Sep 02, 2000 at 02:05:55PM +0000, Nick Ing-Simmons wrote:
>> 
>> Continuing my testing of 5.7.0 I just tried a day-job OO + overload
>> app. 
>> 
>> It uses overload to build "parse trees" - Damian knows what I mean.
>> 
>> It exploded in deep recursion because the 'nomethod' overload
>> was triggered for %{}. 
>
>When has this change happened?  I see no discussion on p5p,
>and only these changes this year to lib/overload.pm:
>
>Change 6971 on 2000/09/01 by jhi@alpha 'Add the overload warnings to pe'
>Change 6970 on 2000/09/01 by jhi@alpha 'Subject: RE: [PATCH lib/overloa'
>Change 6969 on 2000/09/01 by jhi@alpha 'Subject: [PATCH lib/overload.pm'
>Change 6860 on 2000/08/28 by jhi@alpha 'Subject: [PATCH@6855] _Minor_ c'
>Change 5527 on 2000/03/04 by gsar@auger 'make hints available via global'
>Change 5507 on 2000/03/04 by gsar@auger 'more whitespace removal (from M'
>
>The first three are argument checking of overload::constant, the
>fourth one is a doc patch, the fifth and sixth are code beautification.
>The gv.c which handles the guts implementation hasn't been changed
>around nomethod for a long time, either...

I suspect it has been "broken" ever since %{} & co. were invented.
I could not test the code against 5.6.0 'cos the ->isa bug breaks it.

I am trying to decipher the gv.c code.

Assuming I can find it I suggest:

A. to_hv_amg i.e. %{} and related things do not fall through to 'nomethod'

B. If %{} and co return %_[0] i.e. the object then further looping is 
   supressed.

(A) should avoid breakage like mine.
(B) will break out of an easy to do infinite loop and 
    a way to optimize the "access to self" if you _do_ want the overload.






-- 
Nick Ing-Simmons


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About