Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethink how custom default values are treated. #21

Open
ergl opened this issue Jun 18, 2021 · 0 comments
Open

Rethink how custom default values are treated. #21

ergl opened this issue Jun 18, 2021 · 0 comments

Comments

@ergl
Copy link
Owner

ergl commented Jun 18, 2021

Right now we're treating custom default values (proto2) as default assignments to the fields:

// proto
message Message
    optional int32 foo = 1 [default = 10];
}

// pony
class Message
  var foo: (I32 | None) = 10

For oneof fields, if several options have a custom default value:

// proto
message Message {
    oneof test {
        int32 foo = 1 [default = 10];
        int32 bar = 2 [default = 20];
    }
}

// pony
class Message
  var test: ((MessageFooField, I32) | (MessageBarField, I32) | None) = // ???

we have to choose which default value to use, but ideally we'd support all. Right now we're doing LWW, meaning, last default value (in field number order) wins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant