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
SenasOzys has quit [Remote host closed the connection]
SenasOzys has joined #ponylang
OtakuSenpai has joined #ponylang
OtakuSenpai has quit [Client Quit]
OtakuSenpai has joined #ponylang
SenasOzys has quit [Ping timeout: 272 seconds]
OtakuSenpai has quit [Remote host closed the connection]
SenasOzys has joined #ponylang
SenasOzys has quit [Remote host closed the connection]
SenasOzys has joined #ponylang
_whitelogger has joined #ponylang
SenasOzys has joined #ponylang
SenasOzys has quit [Remote host closed the connection]
SenasOzys has joined #ponylang
SenasOzys has quit [Remote host closed the connection]
OtakuSenpai has joined #ponylang
SenasOzys has joined #ponylang
SenasOzys has quit [Remote host closed the connection]
SenasOzys has joined #ponylang
SenasOzys has quit [Remote host closed the connection]
SenasOzys has joined #ponylang
wryun has joined #ponylang
wryun has quit [Quit: wryun]
wryun has joined #ponylang
OtakuSenpai is now known as Nawab
wryun has quit [Quit: wryun]
_whitelogger has joined #ponylang
Nawab has quit [Quit: Leaving]
jdhorwitz has joined #ponylang
<jdhorwitz> Last week in Pony - August 26, 2018 - https://www.ponylang.org/blog/2018/08/last-week-in-pony---august-26-2018/
<SeanTAllen> ^5 jdhorwitz
<jdhorwitz> ?
<SeanTAllen> high five
<vaninwagen> low five jdhorwitz
<jdhorwitz> Lol
<SeanTAllen> would that be v5 vaninwagen ?
<vaninwagen> Exactly, but i considered this notation to be even more confusing
<vaninwagen> So i went for the --verbose approach
jdhorwitz has quit [Quit: Connection closed for inactivity]
endformationage has joined #ponylang
wryun has joined #ponylang
<SeanTAllen> hi wryun
<SeanTAllen> So, what is the problem?
<SeanTAllen> there's no deep clone. for there to be one, everything that goes into an Array would have to be cloneable. Not a limitation we've been able to justify on Array.
<SeanTAllen> iterating the values is what you would need to do.
<SeanTAllen> question though... do you need an Array ref?
<SeanTAllen> this works as well, but i assume you have are posting a simplified example: https://playground.ponylang.org/?gist=b1b35d1f4e3173f80a249491e748a262
<wryun> Thanks Sean - the 'buffer' needed to be mutable in the way I was using it (hence the ref), and I was surprised there was no trivial way to convert a mutable buffer into a string without explicitly iterating over the elements. Wanted to make sure I wasn't missing something, which it sounds like I wasn't.
<wryun> In the end I ended up with something entirely different:
<wryun> (let to_send, let new_buffer) = (consume data).chop(n)
<wryun> let old_buffer = _buffer = consume new_buffer
<wryun> old_buffer.append(consume to_send)
<wryun> received_line(conn, String.from_iso_array(consume old_buffer).>strip())
<SeanTAllen> yup, you are on to a somewhat common pattern
<SeanTAllen> you'll find something like that happening in TCPConnection except the _buffer is an iso
<wryun> Ah, thanks
<SeanTAllen> i dont have a StackOverflow account, otherwise I'd put something there as well to make it look like "hey, he got an answer".
<SeanTAllen> i'm not sure if any Pony committers have SO accounts
<wryun> Looks like some questions got answers: https://stackoverflow.com/questions/tagged/ponylang
<wryun> Sorry for not using the mailing list and following the directions!
<wryun> I can answer it myself later.
<wryun> I still need to think a little bit more about why iterating over the values works (i.e. manual deep clone) but it's not possible for array to implement a deep clone.
<wryun> (well, not even a deep clone - I mean, it's just a clean copy of the array, right?)
<SeanTAllen> Array has clone but you'll get a `ref` back. Deep clone would require everything to be cloneable.
<SeanTAllen> With clone, its a shallow copy
<wryun> So, is it always possible to copy the array by iterating and not by calling a method? Or does it depend on what's in the array?
<SeanTAllen> When you iterate, you can do the proper thing to copy.
<SeanTAllen> In your case tho, you needed to iterate because `clone` would give you back a `ref` which isn't what you wanted.
<SeanTAllen> There's some ideas on being able to have different methods for different return refcaps but that is just some ideas being kicked around and is a long way from being anything substantial.
<wryun> I assume the key point is that the 'proper thing' differs depending on the type, right?
<SeanTAllen> Yes.
<wryun> Right, makes sense - thanks for you help!
<SeanTAllen> Every type could have a "clone" or "deep clone" method on it to do the right thing.
<SeanTAllen> That would be one way to address.
<SeanTAllen> But that's not something that I think anyone has a particular stomach for at this time.
<SeanTAllen> And even if they did, it wouldn't address your issue which was "i want something that isnt a ref back"
<wryun> So in theory the stdlib could have some methods for copying arrays of primitives.
<wryun> Or would I still be stuck with a ref?
<wryun> (that could return an iso, right?)
<SeanTAllen> Someone could probably write up enough primitives to do the right thing.
<SeanTAllen> Sorry have to run. My flight is boarding soon.
<wryun> Thanks