`print` bug
opened this issue · comments
Deleted user commented
each <double, double> AsymmetricPair in MyLinearMap {
print(it.first + " : " + toString(it.second))
}
will print gibberish.
This worked:
each <double, double> AsymmetricPair in MyLinearMap {
print(toString(it.first) + " : " + toString(it.second))
}
Isaac Shelton commented
Ah this is a weird issue. It's caused by trying to add a double
to a String
.
It doesn't differentiate order of adding double
and String
, it uses __add__(a String, b double)
, which incorrectly causes the value of the double to be after the value of the string.
There also seems to be an issues with there not being a way to have a __add__(a double, b String)
function exist or be preferred, so this is a bug.
So yes, to get the correct behavior currently, the String
part of the addition must be on the left.