Perl's Type System

Two companion papers defining the type system that PSC checks. Perl has always had types — sigils, context, coercion — but no one had written them down formally until now.

Understanding Perl's Type System: A Practical Guide

The practitioner-facing paper. Covers the two tests for type membership (round-trip conversion and behavioral correctness), the full type hierarchy from Scalar down to Int, special cases like Bool and DualVar, and how existing tools (Moose, Types::Tiny) map onto the formal framework. Includes real-world scenarios: CSV parsing, API validation, money/float precision, debugging type confusion.

Read the practical guide

Formal Definition of Perl's Latent Dynamic Type System

The mathematical companion. Defines the value space, observational equivalence, coercion judgments, and the complete type lattice with proofs. Establishes that type membership requires both syntactic preservation and semantic fulfillment, proves the subtyping chain Int <: Num <: Str <: Scalar, and works seven examples including the NaN edge case. References Cartwright & Fagan (soft typing), Tobin-Hochstadt & Felleisen (occurrence typing), and Siek & Taha (gradual typing).

Read the formal definition