<doublec>
emilbayes: because that creates the ref inside the recover so it can't escape and is therefore safe
<doublec>
emilbayes: yes, that bullet point is the example I did above
<emilbayes>
doublec: Ah! Neat, so I clearly am still learning about recover ^^
<doublec>
emilbayes: not the words "insude a recover expression"
<doublec>
s/not/note/
<emilbayes>
ahh, didn't see that
<emilbayes>
that's exactly what they do in the string example below
<doublec>
right
<doublec>
That example needs simplifying :)
<emilbayes>
doublec: Can I do something like "consume" the `ref` at some point so I don't need to wrap it in a recover block?
<doublec>
emilbayes: you can't consume a ref to a val because there could be other 'ref' aliases to the same object somewhere else - that's what ref is for
<doublec>
emilbayes: if it was an iso you could
<emilbayes>
doublec: Oh alrigth
<emilbayes>
doublec: This clears up so many misconceptions I had
<emilbayes>
doublec: I was trying to find my way with passing strings to functions that mutate the original string, and thought ref would be the most suitable capability
<doublec>
recover is a way to have a block where the inputs are restricted and the outputs can't escape so you can safely convert anything created inside it to something else.
<emilbayes>
doublec: Ah I get it now
<doublec>
emilbayes: ref is a good way to do that but it does restrict what you can do because some functions expect a val string.
<doublec>
emilbayes: but you can call those mutating functions inside the recover block too
<doublec>
generally you do all your mutation inside the recover and return it from that block as a val.
<emilbayes>
doublec: Ah alright
<emilbayes>
doublec: Is this a general pattern? I might have too many C habits still to understand how pony "should" be done
<doublec>
emilbayes: yes, it's a general pattern
<emilbayes>
doublec: like in C where you manage your data yourself (maybe with a init function) and then pass that various function that mutate your data
<emilbayes>
doublec: I actually think I tried to read that but it was a bit too dense/abstract for me. Maybe because I had my specific application in mind
<emilbayes>
doublec: You have a lot of good resources! ^^
<doublec>
yeah that post is a bit more specific about fields of an object rather than creating mutable objects to use later as a val.
<doublec>
thanks :)
<emilbayes>
doublec: I especially enjoyed the one on bang / hat / arrows
vaninwagen has quit [Ping timeout: 240 seconds]
<doublec>
It's amazing how aliasing creeps in - Pony makes you realise how many possible race conditions you might have in your C programs without knowing.
<emilbayes>
doublec: Haha yes!
<emilbayes>
doublec: Pony definitely tells you how sloppy your thinking is
vaninwagen has joined #ponylang
vaninwagen has quit [Ping timeout: 260 seconds]
<emilbayes>
Does "type ByteSeq is (String | Array[U8] val)" mean that I can't have a `ByteSeq ref`?
jemc has joined #ponylang
nyarum has joined #ponylang
nyarum has quit [Remote host closed the connection]
nyarum has joined #ponylang
<SeanTAllen>
a string ref would be a byteseq emilbayes
<SeanTAllen>
well
<SeanTAllen>
that depends i suppose on context for how you were meaning that
<emilbayes>
SeanTAllen: So I don't know what I was getting wrong in my local version
<SeanTAllen>
what do you get locally emilbayes ?
<emilbayes>
SeanTAllen: It turned out that I was creating a Array[U8] inside a recover block so it was ref where my function was expecting val
<emilbayes>
so I totally misunderstood the error message
<SeanTAllen>
ah
<emilbayes>
Yay, made it to twitter!
<emilbayes>
SeanTAllen: Watching your CodeMesh talk atm btw. Good stuff!
nyarum has quit [Remote host closed the connection]
<SeanTAllen>
thanks
<SeanTAllen>
i have 2 pony talks coming up in the next 3 weeks
<SeanTAllen>
although they are fairly similar, same content, different story
nyarum has joined #ponylang
nyarum has quit [Ping timeout: 268 seconds]
<emilbayes>
SeanTAllen: I've recently gotten into speaking, and trying to do a bunch of original content at once is really straining. Bceause it's just as much about the delivery / progression / story telling as the content itself
<emilbayes>
I don't think there's any shame in reusing the same talk because it's going to be different each time and you get to improve it between sessions :)
nyarum has joined #ponylang
pduncan has joined #ponylang
pduncan has quit [Ping timeout: 240 seconds]
nyarum has quit [Remote host closed the connection]
pduncan has joined #ponylang
pduncan has quit [Ping timeout: 246 seconds]
nyarum has joined #ponylang
nyarum has quit [Ping timeout: 240 seconds]
_andre has quit [Quit: leaving]
k0nsl has quit [Quit: “If we don't believe in freedom of expression for people we despise, we don't believe in it at all — Noam Chomsky”]