in reply to Where does the spurious error message come from?

Some additional info:

> where the magic brace-guessing heuristics is broken?

From List::More

> any { BLOCK } @list;

so any() has a prototype, so no "magic guessing" here, a {...} must be seen as a block.

I can only guess your compile time error of an undeclared var aborts before properly importing any() with prototype.

I think the problem might be even deeper.

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: Where does the spurious error message come from?
by kikuchiyo (Hermit) on Aug 04, 2023 at 15:09 UTC

    If you switch the order of the functions in the code, the spurious error message goes away.

    By the way, I'd be interested to know how other versions of perl behave - IIRC there were some changes in 5.38 to error handling with the intent to show more readable error messages.

      A compiler that proceeds after recognising an error reminds me of the time when I had to program in PL/I. That beast was designed for those circumstances where you drop a box full of punched cards at the data centre's desk and get the compiler's result the next day. A missing semicolon would have cost you one full day unless the compiler were forgiving enough and guessed you intention. Some of the most serious programming errors, like assigning incompatible types, e.g. pointer to character, resulted in an inconspicuous warning "data conversion done by subroutine call".

      Greetings,
      -jo

      $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$
        I bet that the your warning was buried in a blizzard of warnings about conversions that you did intend. In Perl, there is almost no penalty for recompiling after fixing a few obvious errors. I have come to expect that some of the remaining ones will disappear.
        Bill
      > you switch the order of the functions in the code, the spurious error message goes away.

      That's an indication that my direction of thinking was right.

      Only monks versed with the parser phases will be able to tell better

      But I see you just posted that it was fixed in 5.38, so maybe not worth further digging. :)

      Cheers Rolf
      (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
      Wikisyntax for the Monastery