develooper Front page | perl.perl5.porters | Postings from April 2016

Re: [perl #127552] No warning or error on <at> $

Thread Previous
From:
Dave Mitchell
Date:
April 5, 2016 12:46
Subject:
Re: [perl #127552] No warning or error on <at> $
Message ID:
20160405124619.GP4160@iabyn.com
On Tue, Feb 16, 2016 at 08:45:31PM +0100, shmem wrote:
> >From the keyboard of Ed Avis [16.02.16,16:38]:
> >It will also help to spot typos - I see that you do not see much value in
> >that, because there would still be plenty of other typos and mistakes
> >which are not detected.  I disagree and feel that spotting mistakes such
> >as @$ for $@ is useful.
> 
> I am with Abigail on that: excellent candidates for perl critic.

Conversely, one important use of 'use strict' is to spot typos in
variable names.

I think I'm in favour of emitting a warning each time a slot of a
punctuation var typeglob is populated which doesn't have a current
documented purpose. So use of '@$' would emit a single compile-time
warning along the lines of:

    '@$' is a reserved punctuation variable

while of course '$$' wouldn't.

This wouldn't affect golf, japh's etc unless they are run with -w
(which by their very nature, they probably aren't).

perlvar would make it clear that any undocumented vars will emit this
warning, and that they may acquire a new use in a future release of perl.

-- 
You're only as old as you look.

Thread Previous


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