>Do you take advantage of Swift's pattern matching in your support for
Cap'n Proto unions?
Yes! A union is generated as just an enum with associated values :)

>How do you manage the lifetime of a message's underlying buffer?
Swift's native memory management model is ARC, so I'm going with that. Once
the message loses all references to it, the buffer gets deallocated.
Ideally each object the user makes has some kind of reference to the
message, so it would work right out of the box (this is the idea, but I
have not finalized the design of who references who, so it may not behave
correctly just yet).

Dan

On Tue, Sep 20, 2016 at 6:47 AM David Renshaw <da...@sandstorm.io> wrote:

> Cool!
>
> Do you take advantage of Swift's pattern matching in your support for
> Cap'n Proto unions?
>
> How do you manage the lifetime of a message's underlying buffer? Is it
> like in capnproto-c++, where the burden is on the programmer to ensure that
> references to a message's interior do not outlive the message itself? Or is
> it more like capnproto-java, where that burden is taken up by automatic
> memory management, at the cost of some run time performance? It's totally
> unclear to me which would be the better choice for Swift.
>
>
> - David
>
>
> On Mon, Sep 19, 2016 at 9:03 PM, Dan Appel <dan.appe...@gmail.com> wrote:
>
>> Hi! I've been working on a Swift compiler plugin for the past week or so,
>> and have been making decent progress. I've run into a few blind spots in
>> the encoding spec (i.e. unions) but seemed to have gotten over the major
>> humps.
>>
>> Just wanted to let people know in case somebody has tips or concerns.
>>
>> I'll also use this thread as a place to ask any future questions that I
>> may have :)
>>
>> --
>> 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 capnproto+unsubscr...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/capnproto.
>>
>
> --
Dan Appel

-- 
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 capnproto+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to