On Thu, Jun 6, 2019 at 7:41 PM Prasanth Somasundar <[email protected]> wrote:

> Hey guys,
> I've updated the doc
> <https://docs.google.com/document/d/12qMVyQPOWTXviFKIpjKLXgusKZ95miuRmu9AxacyGOA/edit?usp=sharing>
> with a new write API suggestion. The gist is that writes never happen to
> the byte array. Instead, we build a virtual proto on top of the byte array
> that's accessed first for any modifications. It's built using `Maybe` all
> the way down. `Nothing` implies that there are no changes from the byte
> array. When you transmit/convert it into bytes, the framework performs a
> "merge" operation before sending over the wire. We will also provide this
> merge operation to advanced users who wish to manually do this compaction
> at some points.
>

This sounds like almost a standard design pattern in pure-functional
languages -- amortize modifications by storing them to a side structure
with periodic merges. I feel like I read about this kind of approach in
Osaki's "Purely Functional Data Structures" (though it's been a while...).

Which is to say, it seems like a pretty reasonable approach. :)

-Kenton

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/CAJouXQmvxD7hqTD7Ltn_32mQSDgUnobcSRPwUEbG84JSzd7QDA%40mail.gmail.com.

Reply via email to