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:
Paul Johnson
Date:
July 18, 2012 06:35
Subject:
Re: [perl #114178] di/ds/ig exempt from warnings in void context
Message ID:
20120718133525.GC10635@pjcj.net
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.

-- 
Paul Johnson - paul@pjcj.net
http://www.pjcj.net

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