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

do we really need the "(printf?|sort) interp. as function" warning?

Thread Next
From:
Jeff 'japhy' Pinyan
Date:
July 11, 2001 13:39
Subject:
do we really need the "(printf?|sort) interp. as function" warning?
Message ID:
Pine.GSO.4.21.0107111636250.7766-100000@crusoe.crusoe.net
This is drawn from S_checkcomma() in toke.c.  It makes little sense to me.

    if (*s == ' ' && s[1] == '(') {     /* XXX gotta be a better way */
        if (ckWARN(WARN_SYNTAX)) {
            int level = 1;
            for (w = s+2; *w && level; w++) {
                if (*w == '(')
                    ++level;
                else if (*w == ')')
                    --level;
            } 
            if (*w)
                for (; *w && isSPACE(*w); w++) ;
            if (!*w || !strchr(";|})]oaiuw!=", *w))
                Perl_warner(aTHX_ WARN_SYNTAX,
                            "%s (...) interpreted as function",name);
        }
    }

Good heavens.  What is so special about the characters ";|})]oaiuw!="?

  print(")");    # no warning
  print (")");   # warning
  print  (")");  # no warning
  print (")a");  # no warning
  print (")b");  # warning
  print (")=");  # no warning
  print (")+");  # warning

Please help me understand this.  Can't we do something about this?  Like,
get rid of it maybe?  Or make the warning more intelligent?

-- 
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **


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