Hi,

Indeed, it looks like I forgot to document evolution of return types.

The parenthesized return list is handled the same as the parameter list.
You can add new fields to the end, and you should give them default values.
These parenthesized lists are actually converted into struct definitions
behind the scenes, with the field numbers corresponding to the position of
the parameters in the list.

When the parameters or the return type are *not* a parenthesized list, then
they are required to name a struct type. In this case, that struct type is
used directly, rather than auto-generating an anonymous struct type from
the parenthesized list. So, you can convert a parenthesized list to a raw
struct or vice versa by ensuring that the parenthesized list's members
match the struct's fields.

You gave this example:

    func @0 () -> :Data;

But this is not valid, because `Data` is not a struct type (also, there is
a syntax error: there shouldn't be a colon before the type in this context).

-Kenton

On Fri, May 29, 2020 at 12:27 PM <[email protected]> wrote:

> The Evolution section of the schema
> <https://capnproto.org/language.html#evolving-your-protocol> does not
> document any way to evolve a return value of a method. Is it possible to
> evolve function returns, and if so what are the rules? Especially as it
> applies to returns without parens (can I evolve func @0 () -> :Data; into
> say func @0 () -> (data :Data, other :Text);)
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/capnproto/064e09f3-e8ee-49e3-b0dc-022c0b5e68a3%40googlegroups.com
> <https://groups.google.com/d/msgid/capnproto/064e09f3-e8ee-49e3-b0dc-022c0b5e68a3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/CAJouXQm4-z71%2BBmhpwRj-R8c88b_1ddRcmSrQeqXjz44kaZjHg%40mail.gmail.com.

Reply via email to