This document discusses how constraints should be generated and resolved for sound inference of composite types.

Arrays (R Vectors)

The simplest possible scenario for type inference on composite types is a direct call to a zero-filled vector constructor.

x = numeric(4)

In this case, the type of the right-hand side is known and inference should:

  1. Bind x#1 to the write operand.
  2. Bind x#1 to x.
  3. Add the constraint x#1 <=> ArrayType(RealType, 4)

This scenario becomes more difficult when the length argument is a variable.

n = 4
x = numeric(n)


duncantl/RTypeInference documentation built on Jan. 16, 2021, 12:30 a.m.