OpenCyphal / pycyphal

Python implementation of the Cyphal protocol stack.
https://pycyphal.readthedocs.io/
MIT License
123 stars 106 forks source link

Possible name conflict #13

Closed pavel-kirienko closed 8 years ago

pavel-kirienko commented 8 years ago

Implementation-specific fields of CompoundValue such as mode, is_union, etc. may conflict with DSDL-defined fields.

A possible solution is to prefix these fields with underscore (a regular DSDL field always starts with a letter character so this rules out a conflict), and implement global accessors available via package namespace uavcan., e.g.:

def get_data_type_id(obj):
    return obj._data_type_id

def set_data_type_id(obj, data_type_id):
    obj._data_type_id = data_type_id

def is_union(obj):
    return obj._is_union

def get_union_field(obj):
    return obj._union_field

def set_union_field(obj, name):
    obj._union_field = name

As for CompoundType.mode, it does not seem to be used anywhere outside constructor, and if so it should be removed.

@bendyer do you think this is a sensible idea?

bendyer commented 8 years ago

Yes, I think that's reasonable.