************* Limited Types ************* Limited types provide a way to define new, restricted types based on existing types in a way that is different from subclassing. For example, there is no built-in ```` type, but it could be defined as follows: .. code-block:: dylan define constant = limited(, min: 0, max: 255); Open Dylan can often provide improved error checking and optimizations for limited types. For example, this code could generate a compile time error: .. code-block:: dylan define function add1 (b :: ) => (b2 :: ) b + 1 end; add1(255); The set of limited types that are supported depends on the compiler. Collection classes can be limited to containing a specific type of element: .. code-block:: dylan define constant = limited(, of: ); Open Dylan will optimize accesses into an ```` defined as above. Open Dylan can avoid doing bounds checking or type checking, and can use an efficient representation of the vectors of floating point numbers for this code: .. code-block:: dylan define constant $audio-buffer-size = 2048; define constant = limited(, of: , size: $audio-buffer-size); define function mix-buffers (input1 :: , input2 :: , output :: ) => () for (i from 0 below $audio-buffer-size) output[i] := 0.5 * input1[i] + 0.5 * input2[i]; end; end;