How to force value to String in Pony?

I'm trying to learn Pony, and for obvious reasons, one of the first things I want to do is print values.

However, this does not seem to work for most things, for example:

env.out.print(2 + 2)

Gives an error:

Could not infer literal type, no valid types found

I also tried:

let four: U32 = 2 + 2
env.out.print(four)

But this gives a more ugly mistake: I need something that is a subtype ByteSeq. OK, but how do I get one of them?

+4
source share
1 answer

You need to convert the integer to String.

Pony has an interface called Stringablethat declares a function string(fmt), and many classes implement that interface. For example, integers.

.string(), - . ​​

+7

All Articles