At 8:04 AM -0700 3/26/09, Graham Barr wrote:
>On Mar 26, 2009, at 7:15 AM, Dave Mitchell wrote:
>
>>On Thu, Mar 26, 2009 at 09:05:24AM +0100, Bram wrote:
>>>The subject of the patch ('mandatory warning') suggests that it is
>>>intended that the warning can't be disabled. (Which agrees with perldiag
>>>because of the lack of (W redefine))
>>
>>If I were to hazard a guess, I'd say it's because const sub uses are
>>in-lined at compile-time; therefore changing the sub definition later is
>>likely to surprise the user:
>>
>> sub FOO() { 1 };
>> *FOO = sub() {2};
>> print FOO, FOO(), &FOO(), "\n";
>>
>>which prints
>>
>> 112
>
>and
>
>sub FOO () { 1 }
>sub BAR { FOO }
>sub FOO () { 2 }
>print FOO,BAR;
>
>prints 21
>
>It was intentional at the time we added constant subs to give the
>warning unconditionally
>Graham.
local $SIG{__WARN__} = sub {};
*will* however take care of the warning... ;-)
Liz
Thread Previous