<jemc>
eventually, writev will actually use a more efficient mechanism than iterating over the buffer array, so formatting your code to use it now is a good idea
<jemc>
for high-performance stuff we want to avoid flattening a collection of buffers into a single one, as that is unnecessary allocations and copying
<jemc>
Perelandric: I don't think you can do the equivalent with a constructor, you'd have to do something else
<jemc>
with more info about what you're trying to do, maybe someone could give a recommendation
<jemc>
I'm on my way out the door at the moment though
<jemc>
good luck!
jemc has quit [Ping timeout: 252 seconds]
runehog has quit [Remote host closed the connection]
<Perelandric>
jemc: Thank you. Overall, I'm exploring different ideas and wanted to make sure I wasn't missing something.
<Perelandric>
The ctor is for a `val` class and needs to receive a stream of data to construct itself...
<Perelandric>
so the stream, needing to modify itself, needs to be mutable and sendable (iso).
<Perelandric>
The issue is that the ctor needs to call other ctors to populate a Array field.
<Perelandric>
...from the same stream.
<Perelandric>
This part is mostly internal, so I'll get by with just calling a `fun` that does the reading/parsing...
<Perelandric>
and passes the resulting data to the ctor.
trapped has quit [Ping timeout: 246 seconds]
unbalancedparen has quit [Quit: WeeChat 1.5]
runehog has joined #ponylang
felixgallo has quit [Ping timeout: 246 seconds]
mrkishi has quit [Ping timeout: 244 seconds]
mrkishi has joined #ponylang
runehog has quit [Remote host closed the connection]
runehog has joined #ponylang
Perelandric has quit [Ping timeout: 250 seconds]
zaquest has quit [Ping timeout: 272 seconds]
zaquest has joined #ponylang
felixgallo has joined #ponylang
jemc has joined #ponylang
SilverKey has joined #ponylang
SilverKey has quit [Quit: Halted.]
felixgallo has quit [Ping timeout: 252 seconds]
amclain has quit [Quit: Leaving]
srenatus has joined #ponylang
copy` has quit [Quit: Connection closed for inactivity]
jemc has quit [Ping timeout: 276 seconds]
hibnico has joined #ponylang
hibnico has quit [Quit: hibnico]
hibnico has joined #ponylang
hibnico has quit [Quit: hibnico]
aturley_ has joined #ponylang
hibnico has joined #ponylang
aturley has quit [Ping timeout: 246 seconds]
unbalancedparen has joined #ponylang
mrkishi has quit [Ping timeout: 260 seconds]
_andre has joined #ponylang
trapped has joined #ponylang
<Candle>
Is there a "wait for these N different events and then do something else" pattern around?
<SeanTAllen>
Candle: not at the moment. We are doing that in one of our apps here at Sendence but we haven't extracted that to any sort of reusable pattern yet.
<SeanTAllen>
in general what we do, is we have an actor that is responsible for receiving notification that these different events have happened and when the trigger is hit, it does whatever is needed to start the something else
<SeanTAllen>
in our case that is multiple actors informing this coordinator of things happening on startup like sockets successfully opening etc and then the coordinator informs "home base" that its ready to go and everything is configured. "home base" is another app waiting for all of the processes it started up across the network to let it know they are ready and when
<SeanTAllen>
they have all checked in, it triggers another app to start test runs.
TwoNotes has joined #ponylang
<TwoNotes>
Is there already a stdlib function to flatten an Array[ByteSeq] into Array[U8]?
srenatus has quit [Quit: Connection closed for inactivity]
Perelandric has joined #ponylang
SilverKey has joined #ponylang
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ponylang
felixgallo has joined #ponylang
mitchellvanw_ has quit [Quit: ZNC 1.6.3+deb1+trusty0 - http://znc.in]
mitchellvanw has joined #ponylang
mitchellvanw has quit [Quit: ZNC 1.6.3+deb1+trusty0 - http://znc.in]
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ponylang
jemc has joined #ponylang
jemc has quit [Client Quit]
jemc has joined #ponylang
<SeanTAllen>
not that i am aware of
<Candle>
SeanTAllen: Fair enough, I now have a 10? line actor to do that sort of thing.
trapped has quit [Read error: Connection reset by peer]
amclain has joined #ponylang
felixgallo has quit [Ping timeout: 252 seconds]
mrkishi has joined #ponylang
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ponylang
SilverKey has quit [Client Quit]
<SeanTAllen>
ours are quite a bit longer but what is being coordinated is rather complicated.
felixgallo has joined #ponylang
SilverKey has joined #ponylang
SilverKey has quit [Quit: Halted.]
hibnico has quit [Quit: hibnico]
bb010g has joined #ponylang
SilverKey has joined #ponylang
SilverKey has quit [Client Quit]
SilverKey has joined #ponylang
SilverKey has quit [Max SendQ exceeded]
SilverKey has joined #ponylang
Praetonus has joined #ponylang
<jemc>
TwoNotes, your best bet is to iterate over the `Array.values` and do `Array.append`
<TwoNotes>
Sounds easy enough. I can see several applications for WriteBuffer beyond network comms.
Matthias247 has joined #ponylang
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ponylang
michael_campbell has quit [Read error: Connection reset by peer]
<TwoNotes>
Copying could be reduced with a version of WriteBuffer that really wrote to a single buffer istead of separating chunks.
<SeanTAllen>
So an array?
<jemc>
if you're just talking about writing numbers and such to a single chunk, you should be able to use WriteBuffer.reserve to make sure there is enough room for everything ahead of time
<jemc>
if you're calling `WriteBuffer.write` and you want it to be in the same chunk with something else, you're going to have to make it copy at that point anyway, so you wouldn't be avoiding a copy
Applejack_ has joined #ponylang
<TwoNotes>
For example, I am a big fan of key-value databases. Using WriteBuffer seems like a good way to replicate the Erlang "external binary format" coding.
<TwoNotes>
One could also use JSON for that of course, if space is not such an issue
Applejack_ has quit [Ping timeout: 272 seconds]
SilverKey has quit [Quit: Halted.]
sylvanc has quit [Ping timeout: 252 seconds]
sylvanc has joined #ponylang
<TwoNotes>
jemc, the copy that would be avoided was the one at the end, flattening all the chunks into one buffer, to be transmitted or stored all in one piece. Especially if a reasonable preallocation of the buffer had been done.
mrkishi has quit [Quit: No Ping reply in 180 seconds.]
mrkishi has joined #ponylang
SilverKey has joined #ponylang
<felixgallo>
oh how I wish function argument lists weren't so tightly bound to functions
<felixgallo>
or, that the type inference engine was just a little more aggressive
SilverKey has quit [Client Quit]
<felixgallo>
desired: fun derp({_}: Bool): Bool
_andre has quit [Quit: leaving]
SilverKey has joined #ponylang
copy` has joined #ponylang
TwoNotes has quit [Quit: Leaving.]
SilverKey has quit [Quit: Halted.]
<felixgallo>
just accidentally reimplemented monads in pony
<felixgallo>
not sure whether to be pleased or terrified
dom96 has quit [Changing host]
dom96 has joined #ponylang
Praetonus has quit [Quit: Leaving]
<jemc>
TwoNotes: I'm saying that you're just moving the copy to the a different point in the process, not avoiding it
hibnico has joined #ponylang
mrkishi has quit [Ping timeout: 264 seconds]
Matthias247 has quit [Read error: Connection reset by peer]