<aturley>
it isn't intended as a stand-alone document. the idea is to use it as a supplemental reference as you're learning.
<SeanTAllen>
@aturley could you PR that so its available from ponylang.org? linked to from the "learn" section?
<aturley>
SeanTAllen sure
SenasOzys has quit [Ping timeout: 240 seconds]
SenasOzys has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
<SeanTAllen>
thank you sir!
khan has quit [Client Quit]
SenasOzys has quit [Ping timeout: 260 seconds]
khan has joined #ponylang
SenasOzys has joined #ponylang
_rck has joined #ponylang
endformationage has joined #ponylang
gokr has joined #ponylang
vassilvk has quit [Remote host closed the connection]
gokr has quit [Ping timeout: 245 seconds]
gokr has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
ndrwsh has joined #ponylang
<ndrwsh>
hi all. I stuck on the last page of tutorial -- Serialisation with "hello world". I have decided to print bytes let bytes_sx: Array[U8] val = sx.output(output)
<ndrwsh>
but unlike most languages, Pony has zero blocking operations.
<ndrwsh>
so CStringWrapper.print happens INSIDE printing loop
<ndrwsh>
I guess CStringWrapper.print is blocking after all
<ndrwsh>
So I have read Patterns: Async
<ndrwsh>
And made two actors
<SeanTAllen>
what is CStringWrapper ndrwsh ?
<ndrwsh>
Printer with access() and Mathematician with print()
<ndrwsh>
@SeanTAllen CStringWrapper is class on the last page of pony tutorial gitbook
<ndrwsh>
my problem is
<ndrwsh>
I can not pass CStringWrapper to create of Mathematician actor
<ndrwsh>
with error msg:
<ndrwsh>
this parameter must be sendable (iso, val or tag)
<SeanTAllen>
@printf is a C FFI call to printf. That is a blocking operation.
<SeanTAllen>
ndrwsh: you are into a rather complicated area of the appendix. i would suggest playing around with some simpler pony for now.
<SeanTAllen>
you CStringWrapper is a `ref`, you can't send that to another actor
<ndrwsh>
I tried to consume it to val or iso -- but it did'nt work
<ndrwsh>
I feel like there's just one little step -- but I can't make it. Such depressing feeling :(
gokr has quit [Quit: Leaving.]
gokr has joined #ponylang
gokr has quit [Ping timeout: 260 seconds]
<SeanTAllen>
you can't consume a ref
<SeanTAllen>
a ref means "there can be many aliases to this"
<SeanTAllen>
you can consume an iso, not a ref
<SeanTAllen>
refs can never be sent to another actor. you would have to copy a ref to send it to another actor.
<ndrwsh>
oh. like clone
<SeanTAllen>
yes, like clone
<SeanTAllen>
if you want to send a mutable thing from one actor to another, it has to be an iso
<SeanTAllen>
and you have to consume your alias so you can send it to another
<SeanTAllen>
you see the `ref` in this?` fun ref _deserialise(bytes: Pointer[U8] tag) => _cstr = @deserialise[Pointer[U8] tag](bytes)`
<SeanTAllen>
that means, you have to have a ref to call _deserialise, so its going to get kind of tricky with the code you are copying.
<SeanTAllen>
you'd need to make a CStringWrapper clone-able so you could get a val or an iso from your clone, which can be sent to other actors.
<SeanTAllen>
if you are working your way through the tutorial, that's going to be a little advanced.
<SeanTAllen>
not really what i would call a starter project, but not impossible
<ndrwsh>
thank you!
ndrwsh has left #ponylang [#ponylang]
droman has joined #ponylang
<SeanTAllen>
you're welcome
droman_ has joined #ponylang
droman has quit [Ping timeout: 240 seconds]
SenasOzys has quit [Ping timeout: 245 seconds]
droman has joined #ponylang
droman_ has quit [Ping timeout: 252 seconds]
jemc has joined #ponylang
_andre has quit [Read error: No route to host]
droman has quit [Read error: Connection reset by peer]
SenasOzys has joined #ponylang
droman has joined #ponylang
SenasOzys has quit [Ping timeout: 260 seconds]
droman_ has joined #ponylang
droman has quit [Ping timeout: 245 seconds]
droman_ has quit [Quit: WeeChat 2.1]
amclain has joined #ponylang
<_rck>
vaninwagen that pony-kv is useful, thank you!
<_rck>
I tested it a bit and it seems to have some problems stabilizing the state if you have a lot of writes
<_rck>
in the worst case, you need to wait for all the reads to complete before you get a chance to submit your update
<_rck>
which I guess it's a good compromise otherwise your write would be lost
<_rck>
also, I was looking at the Promises package looking for something similar to promise.race() on js
<_rck>
where you submit a list of promises and it returns as soon as one of the promises resolves, and doesn't wait for the others
<_rck>
I see there's a Promise.select() method already, but that also returns the other promises that still need to resolve
<_rck>
I tried to implement my own version, where it only returns the value of the first promise that resolves
<_rck>
but it will still wait for the others to finish, even if we don't care about their result
<_rck>
looking at the promises actor, it seems that even if you reject a promise, the actor will wait for a resolve to happen
<_rck>
but then discard the value
<_rck>
I guess my question is: is there a way to implement this without waiting for the rest of the promises?
<_rck>
alternatively, is this (a race method) a thing that people would care for in the standard promises package?
_rck has quit [Ping timeout: 252 seconds]
endformationage has quit [Quit: WeeChat 1.9.1]
endformationage has joined #ponylang
gokr has joined #ponylang
_rck has joined #ponylang
<SeanTAllen>
_rck: you could do something like race
<SeanTAllen>
it would be easier to do as your own promises library first, work out the API then perhaps RFC as an addition to standard library
<SeanTAllen>
you can't cancel a message send in Pony so results would still be returned from everything but, you could return a result to the user after the first one is done.
pzel has joined #ponylang
<SeanTAllen>
ive never thought about how you would build cancellation for something like. offhand I can't think of how you would do it, given casual messaging.
<SeanTAllen>
well i can think of one way but the tradeoffs arent great.
_rck has quit [Ping timeout: 245 seconds]
droman has joined #ponylang
jemc has quit [Read error: Connection reset by peer]
<SeanTAllen>
@pzel pretty sure its the truncate at the end of rstrip
endformationage has quit [Quit: WeeChat 1.9.1]
<pzel>
SeanTAllen: yeah, I'm also pretty sure that's where the destruction happens, but the parameter is provided by that repeat/until loop, which I'll need to debug to understand
<SeanTAllen>
yeaj so truncate is called with a 1
<SeanTAllen>
and blammo
pzel has quit [Remote host closed the connection]
pzel has joined #ponylang
<pzel>
SeanTAllen: should I submit this as a github issue?
<SeanTAllen>
yup
<SeanTAllen>
found the problem
<SeanTAllen>
i think
<SeanTAllen>
o wait
<SeanTAllen>
hmmm
<SeanTAllen>
nvm
<pzel>
i didn't meant to distract you from whatever else you were busy with :) I'd like to try to suss this out myself
pzel has quit [Read error: Connection reset by peer]
pzel has joined #ponylang
<SeanTAllen>
o this is interesting
<SeanTAllen>
now time to look at contains
_rck has quit [Quit: WeeChat 2.1]
<SeanTAllen>
right so i understand what is happening
<SeanTAllen>
pzel
<SeanTAllen>
5 code points
<SeanTAllen>
starting from the end
<SeanTAllen>
" " is in the characters array for runes
<SeanTAllen>
so we dont break
<SeanTAllen>
but code points 4,3,2
<SeanTAllen>
they are not valid beginnings of points
<SeanTAllen>
so (0xFFFD, 1)
<SeanTAllen>
and we dont break
<SeanTAllen>
when we get to codepoint 1
<SeanTAllen>
its valid and triggers if not chars.contains(c) then