tafia / quick-protobuf

A rust implementation of protobuf parser
MIT License
446 stars 82 forks source link

added keywords #225

Closed snproj closed 1 year ago

snproj commented 1 year ago

Added some more keywords when checking for naming conflicts within generated code. These conflicts can happen in many different ways, so a comment was added describing each type of conflict.

One particularly nasty kind of conflict that I'd like to highlight, however, is when a user-defined message/field name clashes with local variable names or parameter names INSIDE OF a generated function implementation.

Luckily, it seems that the actual chance of this happening in practice at current might be relatively low, since:

I have not yet found any case where this would lead to a hard error, even with rather contrived examples. Nevertheless, this might depend heavily on whatever the current generated function implementations happen to be, and seems to be a source of rather insidious future errors if we aren't careful.

This will probably mean that unless we make some more comprehensive improvements/automation to this name collision system, keywords might have to be updated every time the generated code implementation is updated, even if the public API of said codegen is not affected.