IDL4-CSHARP 1.0 FTF Avatar
  1. OMG Issue

IDL4CSP — A sequence member in an IDL struct should map to a read-only property

  • Key: IDL4CSP-1
  • Status: closed  
  • Source: Real-Time Innovations ( Mr. Fernando Garcia-Aranda)
  • Summary:

    The spec indicates that all members of a class or struct are mapped to read-write properties, as shown in

    public int a_long { get; set; }
    public short a_short { get; set; }
    public int[] a_long_array { get; set; }

    However sequence members (IList) should map to read-only properties.

    public IList<int> a_long_sequence { get; }

    Rationale: C# best practices recommend this change:

    For example, a vendor may decide to use an implementation of IList that allows accessing the memory directly (via unsafe code or Span) to optimize its serialization. If end users are allowed to completely replace the list, they may inadvertently provide a different IList| implementation that the vendor code can't serialize optimally or can't handle at all.

    The same could apply to Maps.

  • Reported: IDL4-CSHARP 1.0a1 — Sun, 22 Mar 2020 20:10 GMT
  • Disposition: Resolved — IDL4-CSHARP 1.0
  • Disposition Summary:

    Making sequence members read-only properties

    This resolution transforms properties resulting from mapping IDL sequence and maps struct members into read-only properties, following the C# best practices described in the issue.

    It also introduces setters for Unions, where setting a sequence or a map would need to also update the discriminator value.

  • Updated: Mon, 29 Mar 2021 12:23 GMT