Why doesn't __bool__ allow explicit conversion?
I am playing with "Low level IR" level and it works great. However when i try to print out OurBool i get errors stating that OurBool can not be converted to Bool despite having a __bool__ method.
I am using Mojo 6.1
4 Replies
Try doing bool(a) instead with a lower case b. Bool should be a SIMD type im pretty sure
It throws "use of unknown declaration 'bool'" error. I guess there is no lowercase bool() in mojo yet
Ahhh okay I think it’s because traits aren’t complete yet and they don’t have a boolable trait. They talked about doing implicit conformance for traits in the newest newsletter, so my guess is in the next major release bool(a) will work
Thanks! That's what it was. Works as expected(provided explicit declaration) with already implemented Stringable trait and corresponding __str__