RecordFlux icon indicating copy to clipboard operation
RecordFlux copied to clipboard

Message type size in conditions

Open senier opened this issue 4 years ago • 0 comments

When using message types for the fields of a message, sometimes a constraint is required that a length field has the right value even though the length of the field can be determined statically:

package Typesize is

   type Number is mod 2 ** 16;

   type Inner is
      message
         F1 : Number;
         F2 : Number;
      end message;

   type Outer is
      message
         Length : Number;
         Value : Inner
            then null
               --  if 8 * Length = Typesize::Inner'Size;
               if 8 * Length = 32;
      end message;

end Typesize;

For this, referring to the size of a message would be handy. Of course, this message has to be static (no branches in the message graph).

Related: #384

senier avatar Aug 13 '20 17:08 senier