Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 1.22 KB

RFC-0014-Type-System-And-Inference.md

File metadata and controls

35 lines (26 loc) · 1.22 KB

RFC-0014: Type-System-And-Inference

Status: Draft v0.1
Author: Raccoon Core Team
Date: 2025-10-05

Summary

Nominal type system, Java-like casts, Nullable handling, effect inference. All functions must return a value or void.

Null & uninitialised

  • null is the only null literal; uninitialised locals/fields default to null.
  • Strict-null mode enforces Nullable<T>.

Returns & fallibility

  • All functions return a value or void (MISSING_RETURN, VOID_WITH_VALUE).
  • If a body calls fallible APIs, signature must be Result or Either (FALLIBLE_CALL_IN_INFALLIBLE_FN).

Casting

  • (Type) expr or expr as Type.
  • Upcasts allowed; downcasts only after proven narrowing; else INCOMPATIBLE_CAST.
  • tryCast<T>(x): Result<T, Error> when dynamic.

Effects

  • maySuspend inferred from suspension points.
  • mayError inferred from Result flows.

Records & interfaces

  • Inline records: exact-shape structural.
  • Interfaces/classes/enums/types: nominal; no declaration merging.

Forbidden

  • throw and undefined reserved and forbidden.

Lints

INCOMPATIBLE_CAST, FALLIBLE_CALL_IN_INFALLIBLE_FN, UNHANDLED_RESULT, NULL_IMPLICIT_INIT, NULL_FIELD_IMPLICIT_INIT, MATCH_HIDES_CASES.