quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.24k stars 1.01k forks source link

Please rename protobuf field named "const" #6742

Closed pavoljuhas closed 4 days ago

pavoljuhas commented 4 days ago

Description of the issue

Per internal proto checker, the field name const added in #6729 is discouraged, because it overlaps with C++ keyword const. Please rename to e.g. constant and for a good measure also rename the Conts message in a similar way.

Cirq version

You can get the cirq version by printing cirq.__version__. From the command line:

1.5.0.dev at 2bbc3c4c4be92547cc1750546d0ee1a3d50b26f6

BichengYing commented 4 days ago

To be clear, it is sending the warning about const field name not Const message, right?

I cannot use Constant because it is already used in other proto

mhucka commented 4 days ago

To be clear, it is sending the warning about const field name not Const message, right?

@BichengYing Yes, that's correct. Here's the actual warning from the analyzer:

_"WARNING(keywordconflict): 'const' is a keyword (or at least sufficiently close to one to require mangling) in C++. Using it as a field name can be problematic for programmers using your protobuf in that language. The generated code may have syntax errors, or awkward name mangling may occur, or awkward workarounds may be required to access this field. Switch to a less problematic name if possible."