<Perelandric>
The above link is to an earlier, simpler version to keep things cleaner.
<jemc>
I'm not surprised that you're having issues - a general purpose `clone` in Pony with generics has some problems that many of us have discussed before, and I'm not sure it can be really solved without some form of specialization
<Perelandric>
jemc: That alone is actually a pretty big relief. I was going nuts! :)
<jemc>
then the problem that remains is that you're trying to call `clone()` on a `Foo iso` that is still technically part of the array
<jemc>
in this case, what you're doing is safe, since you don't retain a reference to the element you call `clone` on
<jemc>
but the compiler doesn't see it as a safe case of auto recover
<jemc>
automatic receiver recovery, I mean
<jemc>
I'm wondering if george's more permissive model for viewpoint adaptations would make the compiler see it as safe, but I'm not totally sure of this
<jemc>
for now, your best bet for working around the problem is to refactor to use a destructive read
<jemc>
so something like `let x = values(i) = Foo.create(); let item = x.clone(); values(i) = consume x`
<jemc>
that will give you exclusive ownership of the isolated reference, then you can clone it, then you put it back
<jemc>
however, unfortunately, it requires being able to create a "placeholder" value (the `Foo.create()`) that can stay in the place of the `x` you extracted
<jemc>
if goerge's revised model for viewpoint adaptation doesn't solve this, we could probably add an `Array.upsert` method which works like the `HashMap.upsert` method that SeanTAllen added
<Perelandric>
Right now I'm getting "argument is not a subtype of parameter" on `let x = values(i) = Foo.create()`
<Perelandric>
Pointing at the `= Foo.create()` assignment
<Perelandric>
Hadn't thought about trying the `U^` though. That's interesting.
<Perelandric>
Let me see what I'm missing.
<jemc>
sorry, the Foo should be T, and there should be a recover block since your `create` method in your interface is implicitly `ref`
<jemc>
however, after that you run into the problem of the fact that you can't mutate the array without your `fun clone` being `fun ref clone`... which is obviously not ideal
<Perelandric>
Oh, yes of course. I should have seen that. Shame on me.
<jemc>
but it requires `fun clone` to be `fun ref clone`, which is again, not ideal for your purposes probably
<Perelandric>
I think for now, that's going to be fine with `ref`. At least I'll apply this to the actual code and see if I can swing it.
<Perelandric>
Either way, I learned a bunch, and will take this info and do more tinkering.
<Perelandric>
In a couple days, if I'm not getting it to do what I need, I'll stop back here.
<Perelandric>
...or will just learn Java.
<Perelandric>
(kidding!)
<Perelandric>
Thank you for all the help, jemc!
runehog has quit [Remote host closed the connection]
runehog has joined #ponylang
<jemc>
no problem - sorry the answer wasn't more satisfying
<jemc>
hopefully george's rcap checking model will help cases like this (but I'm still not totally sure that it will)
runehog has quit [Ping timeout: 276 seconds]
unbalanced has joined #ponylang
lukecheeseman has joined #ponylang
unbalanced has quit [Client Quit]
lukecheeseman has quit [Ping timeout: 264 seconds]
mcguire has quit [Ping timeout: 265 seconds]
Matthias247 has quit [Read error: Connection reset by peer]
mcguire has joined #ponylang
runehog has joined #ponylang
gsteed has quit [Quit: Leaving]
<emilbayes>
Is there any convention for package names in pony? ie. patterns to use when looking for public repositories for pony code. I'm wanting to learn, and enjoy so the most by reading other peoples code