in reply to Komodo 4.0 Bug ? Unlikely but....

$pi = 3,141592654;

You know, I am really starting to think perl should issue a specific warning on use of the scalar comma operator. It's almost never intentional and a regular source of newbie problems.


Sanity? Oh, yeah, I've got all kinds of sanity. In fact, I've developed whole new kinds of sanity. You can just call me "Mister Sanity". Why, I've got so much sanity it's driving me crazy.

Replies are listed 'Best First'.
Re^2: Komodo 4.0 Bug ? Unlikely but....
by Anonymous Monk on Jan 23, 2007 at 22:24 UTC
    You mean like
    C:\>perl -e"$_ = 2,3" C:\>perl -we"$_ = 2,3" Useless use of a constant in void context at -e line 1.

      No, I don't mean "useless use of foo in void context". I mean something rather more specific, along the lines of "comma operator encountered in scalar context; throwing away whatever precedes it".

      Bear in mind, sometimes the thing that's thrown away isn't a constant. It can be (the return value of) a function call, for instance, and where is the "useless use of foo" warning then?

      I realize there are probably rare situations in which an advanced programmer uses the scalar comma deliberately, but that's why recent versions of perl have added the ability to pragmatically set aside specific types of warnings within a lexical block. In the overwhelming majority of cases, the scalar comma is introduced by programmer error, and the warning would be beneficial.


      Sanity? Oh, yeah, I've got all kinds of sanity. In fact, I've developed whole new kinds of sanity. You can just call me "Mister Sanity". Why, I've got so much sanity it's driving me crazy.