jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang | Please consider participating in our mailing lists => https://pony.groups.io/g/pony
<phvse> is there a way of changing a ref to a val?
<phvse> hmm I might be thinking about this wrong
<phvse> I've got an Array[U8 val] iso from receive function and I want to print it out & send it to the server
<phvse> printing it out requires a box and sending it requires a val
phvse has quit [Remote host closed the connection]
<SeanTAllen> You have a loca variable or a field that is an iso?
_whitelogger has joined #ponylang
<SeanTAllen> regarding printing env.out.print(SOMETHING)... out is an actor, so you are sending to another actor so you can't print AND send somewhere else
<SeanTAllen> you could send a copy for printing
<SeanTAllen> if the iso you want to send is a local variable you can do
<SeanTAllen> env.out.print(consume my_something)
<SeanTAllen> if its a field, that's different, lets say your field is a string iso
<SeanTAllen> like
<SeanTAllen> let _my_field: String iso
<SeanTAllen> what you need to do is a destructive read
<SeanTAllen> let old = _my_field = recover String end
<SeanTAllen> so, previous value of _my_field is bound to old and _my_field is now bound to the new String
<SeanTAllen> then you can do
<SeanTAllen> env.out.print(consume old)
<SeanTAllen> or you could do something like this... https://playground.ponylang.org/?gist=aa1c22b58fa6e7ca386360d13c3a2924
<SeanTAllen> and when you do the destructive read, assign the "old" value to an immutable
<SeanTAllen> so what is in the playground link is probably what you want, assuming its a field
Cavagon has joined #ponylang
khan has joined #ponylang
dipin has joined #ponylang
dipin has quit [Client Quit]
endformationage has quit [Quit: WeeChat 1.9.1]
Cavagon has quit [Ping timeout: 252 seconds]
PrsPrsBK has quit [Quit: PrsPrsBK]
PrsPrsBK has joined #ponylang
khan has quit [Remote host closed the connection]
khan has joined #ponylang
endformationage has joined #ponylang
ExtraCrispy has quit [Remote host closed the connection]
jmiven has quit [Ping timeout: 264 seconds]
jmiven has joined #ponylang
jmiven has quit [Client Quit]
jmiven has joined #ponylang
khan has quit [Remote host closed the connection]
pecan has left #ponylang ["WeeChat 1.6"]
brainpro1 is now known as brainproxy