kulibali has quit [Quit: Going offline, see ya! (www.adiirc.com)]
<doublec>
felko: if the Array[U8] is ref you'll have to copy it
<doublec>
felko: if it's an iso you can recover it to a val without copying
<felko>
how do I copy it ? clone returns a ref
<doublec>
felko: create a new array, and iterate over the old one, pushing items into the new one
<felko>
but push requires the array to be ref
<felko>
doublec: can we use it on an Array val too ?
<felko>
well i could use an iso
<felko>
i think
<doublec>
felko: in general you can work around the copy by using an iso, or by using things inside recover blocks
<doublec>
if the array can be created as a ref inside a recover block, and the population of it done inside of it, then it can be returned from the recover block as a val
<jemc>
felko: if you post a relatively complete snippet, we may be able to help you refactor to use a recover block instead
<felko>
where can i paste a pony snippet with syntax coloring ?
<doublec>
felko: most types have a .string() that let you convert to something printable
<felko>
ok, i'll remember that, thanks again
<doublec>
'recover' is a bit like a safe pointer cast. It can convert anything from inside the recover block to another reference capability when it is returned outside of it
mrkishi_ has joined #ponylang
<doublec>
It does it safely because the recover block is special in that it restricts what can be put inside it and it knows than nothing can be retained that is created inside it.
<doublec>
as a high level introduction to it
<doublec>
So in that recover block we create an array ref but it is returned as an array val. This is safe because the ref cannot be stored anywhere else as it can't escape the recover block.
<felko>
my experience with pointers is pretty limited, but i think i get the idea
<doublec>
You can go a long way in solving problems by using recover somewhere, or consume something else, to fix compiler errors :)
mrkishi has quit [Ping timeout: 250 seconds]
<felko>
ive been doing this for hours now, fixing error by error
<felko>
not the best way to learn a language I guess :/
<felko>
im starting to understand a little more now, thanks to you