develooper Front page | perl.perl5.porters | Postings from July 2012

Re: [perl #114178] di/ds/ig exempt from warnings in void context

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
July 18, 2012 11:39
Subject:
Re: [perl #114178] di/ds/ig exempt from warnings in void context
Message ID:
CAHhgV8j08xivof0hNzV+d11DWSCVJfO0=Z9bqEXZWqxQqP4e4A@mail.gmail.com
On Wed, Jul 18, 2012 at 4:35 PM, Paul Johnson <paul@pjcj.net> wrote:
> On Tue, Jul 17, 2012 at 11:44:35PM -0700, l.mai@web.de wrote:
>
>> % perl -we '"qwertasd"'
>> Useless use of a constant ("qwertasd") in void context at -e line 1.
>>
>> % perl -we '"dsatrewq"'
>>
>>
>> Any string starting with "di", "ds", or "ig" is exempt from "void context"
>> warnings. I can't find any documentation for this misfeature. It should be
>> removed from the interpreter.
>
>
> It's not really a misfeature.  It's more of an old feature.  The code
> explains why it's there:
>
> op.c:1473
>                   /* perl4's way of mixing documentation and code
>                      (before the invention of POD) was based on a
>                      trick to mix nroff and perl code. The trick was
>                      built upon these three nroff macros being used in
>                      void context. The pink camel has the details in
>                      the script wrapman near page 319. */
>
> As far as documentation is concerned, I suppose that it wouldn't be a
> bad thing to make a note of this somewhere.
>
> As far as removing it is concerned, I presume that no one is writing new
> code in this way, and probably hasn't for a few years.  So the removal
> is a trade-off between a slight standardisation and simplification and
> breaking backwards compatibility with some perl4 era programs.
>
> I would side with keeping backwards compatibility.

Considering this is a warning that has to be enabled explicitly, and
that we're talking about perl 4 compatibility here, I wouldn't care
too much about such a minor break of backwards compatibility. I'd be
surprised if this was the first time in the past 18 years that such a
thing happened.

Leon

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