jeremyheiler has quit [Read error: Connection reset by peer]
jeremyheiler has joined #ponylang
<sebastian_>
Thanks SeanTAllen, that worked great. That was a tricky problem to figure out!
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
MalcomX379 has joined #ponylang
MalcomX379 has quit [Excess Flood]
MalcomX691 has joined #ponylang
MalcomX691 has quit [Excess Flood]
shelajev has joined #ponylang
shelajev has quit [Ping timeout: 240 seconds]
sebastian_ has quit [Ping timeout: 252 seconds]
jsgrant has quit [Ping timeout: 240 seconds]
jsgrant has joined #ponylang
jsgrant has quit [Client Quit]
jsgrant has joined #ponylang
tscho has quit [Read error: Connection reset by peer]
tscho has joined #ponylang
user10032 has joined #ponylang
jmiven has quit [Quit: co'o]
jmiven has joined #ponylang
shelajev has joined #ponylang
shelajev has quit []
Praetonus has joined #ponylang
user10032 has quit [Quit: Leaving]
jsgrant has quit [Quit: jsgrant]
jsgrant has joined #ponylang
jsgrant has quit [Client Quit]
jsgrant has joined #ponylang
Xe has quit [Ping timeout: 240 seconds]
obadz has quit [Ping timeout: 240 seconds]
kjekac has quit [Ping timeout: 240 seconds]
kjekac has joined #ponylang
Xe has joined #ponylang
obadz has joined #ponylang
endformationage has quit [Quit: WeeChat 1.9]
jsgrant has quit [Quit: jsgrant]
jsgrant has joined #ponylang
jsgrant has quit [Quit: jsgrant]
jsgrant has joined #ponylang
_whitelogger has joined #ponylang
inara has quit [Quit: Leaving]
inara has joined #ponylang
jsgrant has quit [Quit: jsgrant]
jsgrant has joined #ponylang
<SeanTAllen>
You're welcome sebastian_
samuell has joined #ponylang
_andre has joined #ponylang
ShalokShalom_ has joined #ponylang
ShalokShalom has quit [Ping timeout: 252 seconds]
acarrico has quit [Ping timeout: 246 seconds]
acarrico has joined #ponylang
ShalokShalom_ is now known as ShalokShalom
vaninwagen has joined #ponylang
<kjekac>
can someone give me a pointer to what I'm doing wrong here? https://is.gd/qNtdbI (it's not the whole program, I tried to give a minimal example)
<kjekac>
specifically, line 17 fails since the cap of _myToken is !trn instead of trn. why is this the case?
<kjekac>
I don't understand why it counts as an alias, but apparently I'm missing something.
<vaninwagen>
kjekac, i am also a little puzzled tbh but i think this is because inside an actor behaviour the actor sees itself (i.e. this) as ref
<kjekac>
but that just means that we're reading a trn field from a ref origin, which should still give us a trn result?
<vaninwagen>
kjekac yes that is why i am a bit puzzled
<Praetonus>
kjekac: Calling a method makes an alias of the receiver
<Praetonus>
So in order to call a trn method, the receiver needs to be trn^
<kjekac>
aha!
<kjekac>
so does that mean that I need to consume it and then call it?
<kjekac>
no, that didn't work.
<Praetonus>
Since it is a field, you'll need to do a destructive read
<kjekac>
like, I don't even have three different values to begin with. sure I can create one, but which of one them should that be? and on that do I call the method?
<kjekac>
s/on that/on what/
<vaninwagen>
kjekac, you can nonetheless make split a ref method: fun ref split(n: U64)...
<vaninwagen>
Praetonus kjekac the tutorial needs to be clearer on that. I will update the section about aliasing to also contain this important fact that the receiver is aliased (which is unproblematic for box and ref)
<Praetonus>
kjekac: It depends. What are you using the Token for after the call to split?
<kjekac>
Praetonus: the one I'm calling the method on? I just keep it. it's the money I don't want to send. the Token that is returned from split is supposed to be sent to another User.
<kjekac>
ah yes true vaninwagen. I think I'm probably trying to restrict things more than needed.
<kjekac>
when is it generally advisable to have iso or trn methods?
jemc has joined #ponylang
<Praetonus>
kjekac: Then from the context you're giving, it seems like the token in User doesn't need to be trn
<kjekac>
oh? what would you suggest instead?
<kjekac>
I
<Praetonus>
You can try making split a ref method, and clone the Token in it
<Praetonus>
The new Token would be iso, and you'd be able to send that to another actor
<kjekac>
ah yes, true, iso makes more sense
<kjekac>
but if _myToken is ref, then I wouldn't be able to send it directly to another actor, right?
<kjekac>
so it should probably me iso as well?
<kjekac>
s/me/be/
<Praetonus>
If you're sending it yes, it needs to be iso
<vaninwagen>
is there some way to have one codebase being compatible across many ponyc versions? maybe something that i can check for with ifdef?
<Praetonus>
vaninwagen: I don't think there is a language feature for that
<SeanTAllen>
there's no built in way to do that at this time vaninwagen
<kjekac>
it seems like pattern matching also creates an alias, correct?
<jemc>
kjekac: right, you're creating another named/accessible reference to the same object
<kjekac>
yeah makes sense.
<kjekac>
but then, is there any way in which I can actually access the non-None value from a (Token iso | None)?
<kjekac>
without having to cast it to tag, that is
<kjekac>
jemc: thank you, that is helpful! not because it made my example work, but because I realized that the problem lies elsewhere. :-)
<jemc>
:)
<kjekac>
my "equivalent" would be this https://is.gd/20cj3X, which doesn't work for obvious reasons. but I'm not sure how to work around it. I've tried an intermittent variable which I pattern match on, but I basically have the same problem there: I can't assign the result from split to a variable with type iso.