Ticket #2178 (new bug)
Parrot lacks a boolean type
|Reported by:||lucian||Owned by:|
And instead, boolean contexts fall back to expecting ints. This is not semantically correct, and leads to issues, especially when trying to expose a HLL's object system to the rest of parrot.
In my specific case, I implemented get_bool on Python objects, but Rosella's is_true and winxed's if coerce to int. Rosella and Winxed are doing the least wrong thing possible with that they've got.
Implementing get_integer to return 0 for false, 1 for true and the value for Python ints is simply incorrect. At least in python 0 is falsy, which makes it possible to have this workaround, in other languages it would be required to simply not implement get_bool or get_integer, to not break things.
The workaround in Winxed is the ternary operator (bla ? 1 : 0), which ends up calling bla.get_bool.