Inference Limits

GCSL infers local values and selected present-or-future positions. It does not infer every relationship between types. Explicit annotations help you state an intended interface when a program reaches one of these limits.

The following boundaries affect ordinary programs:

BoundaryWhat to write
An empty list has no independent element typeGive it an annotation or an expected List<T> type
A pure function does not preserve arbitrary future shapesWrite the present or future contract explicitly
Recursive impure results can retain a deferred possibilityUse Present<T> when the result must be present
General type parameters and intersections are unsupportedWrite concrete structural types
There is no None value or optional-type shorthandRepresent alternatives using supported union members
Narrowing recognizes a plain name tested directly by ifBind a field to a name before testing it
Narrowing does not establish facts after an early returnKeep uses inside the narrowed branch
A narrowed mutable name is a branch-local copyDon't try to update the original through that copy
len and show use special call rulesCall them directly or through supported aliases, rather than storing them as ordinary function values

Expected types reach record fields, call arguments, and other supported literal contexts. An unrelated sibling expression is not a general constraint-solving mechanism. For example, annotate an empty list before combining it with independently inferred values.

Warnings do not prevent execution. A union inferred from unlike branch results can produce a warning while the program remains valid. Use gcsl check to inspect the full set of errors and warnings, and gcsl run --dump-types FILE when the inferred shape is unclear.

These are supported-language boundaries, not promises about a future inference engine. The checker implementation and its regression tests are the source for the behavior described here.

Edit this page