Releases: xphp-lang/xphp
Releases · xphp-lang/xphp
v0.2.0
What's Changed
v0.2.0
The first feature release on top of the core monomorphization pipeline.
v0.1.0 specialized generic classes. v0.2.0 extends generics across the
whole declaration surface — classes, interfaces, traits, methods, free
functions, closures, and arrows — each with bounds, defaults, and
variance, behind forward-compatible turbofish syntax at every call site.
Still the same promise: it all compiles down to vanilla PHP with native
type hints and zero runtime dispatch.
Highlights
- Type bounds, checked at compile time — single (
<T: \Stringable>),
intersection (T: \Stringable & \Countable), DNF
((\Stringable & \Countable) | \Iterator), and F-bounded
(<T: Comparable<T>>). Errors point at your instantiation, not the
generated hash. - Default type parameters everywhere — class, method, function,
closure, arrow — with forward refs (Pair<A, B = A>), empty turbofish
::<>, and barenew Cache;for all-defaults templates. - Variance —
+T/-Tmarkers with parse-time position checks and
real subtype edges:Producer<Banana>actually extends
Producer<Fruit>whenBanana extends Fruit. - Function-level generics — generic methods on static/instance
receivers, generic free functions, and nullsafe turbofish
$obj?->m::<T>(). - Generic closures & arrows —
function<T>(…){…}andfn<T>(…) => …,
includinguse (…)and by-refuse (&$x)captures. - Pseudo-types —
self<T>/static<T>/parent<T>in type-hint
and constructor positions. - Full
docs/tree — a per-feature syntax tour,
getting started, how-it-works, runtime semantics, a type-system
comparison, caveats, and errors.
Changed
- Call-site syntax aligned with the PHP RFC: turbofish
Name::<...>.
Parenlessnew Name<...>is now rejected with a message pointing you at
the::<...>form.
Known limitations
See caveats for the full list. In short:
- Variance markers are class-level only (not yet on methods, functions,
closures, or arrows). - Generic closures/arrows that capture
$this, andstaticclosures, are
rejected at the call site. - Reflection sees the dispatcher shape, not the original closure body.
- The variance validator doesn't walk into trait-imported signatures.
Install
composer require xphp-lang/xphpFull changelog: v0.1.0...v0.2.0
v0.1.0
Merge pull request #13 from xphp-lang/split-repos repo: collapse monorepo to single xphp package