ndsev / zserio

zero sugar, zero fat, zero serialization overhead
https://zserio.org/
BSD 3-Clause "New" or "Revised" License
105 stars 27 forks source link

Unexpected error message when using '-withReflectionCode'. #624

Open MisterGC opened 1 month ago

MisterGC commented 1 month ago

Describe the bug When I call zserio myschema.zs -withReflectionCode -python zs_gen_api, I get:

Parsing myschema.zs
Calling C++11 Generator extension check
[ERROR] C++11 Generator: The specified option 'withReflectionCode' needs enabled type info code ('withTypeInfoCode')!

But I haven't used the C++(11) support of zserio.

Expected behavior zserio should not produce error messages for target languages I don't use. In addition withReflectionCode should just activate withTypeInfo if it is necessary. Imo there is nothing wrong with saying 'reflection covers type infos too.'.

Mi-La commented 1 month ago

Note that -withReflectionCode is the C++ Generator specific option - i.e. it doesn't exist for Python / Java generators.

mikir commented 1 month ago

Thanks to point this out. I agree that this behaviour is misleading.

I think, we can move the checking of the command lines arguments from the cross language checking phase to the processing phase. This will avoid such failures. We will do it within the current milestone.

The cross language checking phase has been introduced to find out that something will be clashed in the corresponding language even if the language is currently not used.

Regarding -withReflectionCode option, we have a problem that currently all options are shared between extensions. So, if -withReflectionCode enforced -withTypeInfoCode, it would cause silently generation of type info code for Python. Which is probably not intended.