On Saturday, November 4, 2023 at 11:49:41 PM UTC-4 Carl Gay wrote: Hi. I'm implementing <https://github.com/cgay/protocol-buffers> protocol buffers for a case-insensitive language (Dylan) and I'm wondering if there's prior art that would give me an idea how to handle the following case:
message M { string S = 1; oneof O { string s = 2; } } Since fields M.S and M.s are siblings, the names to access those fields will collide. I can generate the name "s*" for lowercase "s". Since "*" is invalid in proto field names that's future proof. So I think I have a way forward but I'm curious if anyone knows of other languages that have already addressed this, and what they did. The Common Lisp implementation ignores the problem and relies on it not happening. The docs for the PHP implementation don't mention this particular problem. (They do mention reserved names such as Empty being renamed to PBEmpty, but that's not a problem for Dylan.) Thoughts? Prayers? Thanks. -Carl A couple more thoughts: Auto-assigning a different name for the field, such as "s*", would have to be resilient to movement of the fields textually within the file. If the oneof were moved textually above field S the name "s*" could suddenly name a different field. Another possibility: a custom field option: dylan_name = "s*". This assumes access to modify the .proto file, or the need to maintain a copy of it. Maintain a custom name mapping file to pass to the proto parser / code generator. (This is largely an academic exercise. This scenario seems unlikely to happen in practice, especially considering the number of Dylan users on the planet.) -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/eb524684-d548-4b95-8411-77f07a9b28f9n%40googlegroups.com.