cyclonedds-python icon indicating copy to clipboard operation
cyclonedds-python copied to clipboard

In the python language, the union type defaults to "keyless = False"

Open xuhongrun opened this issue 1 year ago • 1 comments
trafficstars

In the python language, the union type defaults to "keyless = False" https://github.com/eclipse-cyclonedds/cyclonedds-python/blob/48418490c76a15d01615403a2c11f4a10b7ef0e0/cyclonedds/idl/_builder.py#L324

But in C/C++ language, the union type does not have a key.

xuhongrun avatar Feb 29 '24 12:02 xuhongrun

But in C/C++ language, the union type does not have a key.

... that may be so, but in the OMG DDS world ... it does optionally have a key, the discriminator. This has always been allowed by the DDS specs, an easy reference is the OMG DDS XTypes specification, wherein 7.2.2.4.4.4.8 "Key Members" states:

In a union type, only the discriminator is permitted to be a key member. The union discriminator is marked as a key by annotating the discriminator itself with the @key annotation [...]

I believe I am being quite generous when I say I think the decision to allow this was misguided ...

eboasson avatar Mar 15 '24 15:03 eboasson