in reply to Re^2: 5.40 released- native boolean- convert to [01] without any warning|error
in thread 5.40 released

Why would you want it to issue a warning in that context? Seems consistent with
print $some[ 1 > 0 ], q[ ], $some[ 1 < 0 ];
  • Comment on Re^3: 5.40 released- native boolean- convert to [01] without any warning|error
  • Download Code

Replies are listed 'Best First'.
Re^4: 5.40 released- native boolean- convert to [01] without any warning|error
by parv (Parson) on Jun 14, 2024 at 10:26 UTC

    Because not to confuse|treat a boolean as integer as it happens in Lua, Ruby (someone else mentioned), Java, & Rust (code+compiler error for last 2 is below).

    A C++ compiler will not complain on implicit conversion (per casual search; a Clang linter warning exists: readability-implicit-bool-conversion).

    In context of Perl, was hoping that "native boolean" -- as mentioned earlier -- would actually be so and no more, to, perhaps, slowly (very) update Perl😐

      Perl doesn't work like any of those languages. In those, type determines operation. In Perl, operation determines type. So comparing how they handle types isn't fruitful. You're assuming that what's best in one framework is best in a different one. You need to start by establishing that this is the case. Your argument fails until then. (I'm not commenting on your conclusion. Maybe it's right; maybe it's wrong. I'm simply saying you failed to show that it's right.)

      Perl also has strong roots in C, yet you omit to mention C anywhere in your post. Note that in C, you do not get a warning from using true and false as numbers. (Again, not commenting on whether this is best or not. I'm saying it's something you should have addressed as it undermines your argument.)