docs(comparison): accuracy pass on the feature grid (caveats + compiler-verified marks) - #29
Conversation
|
| Filename | Overview |
|---|---|
| docs/guides/comparison.md | Accuracy pass on the feature grid: five xphp rows promoted from ✅ to |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Feature Grid Cell] --> B{xphp status?}
B -->|"✅ fully supported"| C[No further action]
B -->|"⚠️ supported with caveats"| D[Cell gets one-line caveat note]
B -->|"❌ absent"| E[What's missing section]
D --> F[Supported with caveats section]
F --> G1[Generic closures + arrows]
F --> G2[Typed closure signatures]
F --> G3[Generic functions/methods]
F --> G4[Declaration-site variance]
F --> G5[Real subtype edges]
G1 & G2 & G3 & G4 & G5 --> H[Full write-up in caveats.md]
Reviews (3): Last reviewed commit: "docs(comparison): link the self-reintrod..." | Re-trigger Greptile
The feature grid compared declaration surface, bounds, variance, and runtime semantics, but never stated a call-site divergence: xphp has no type-argument inference — the ::<> turbofish is mandatory on every generic call, and omitting it is a compile error (needed to pick a specialization under monomorphization). TypeScript, Kotlin, and Rust all infer; Rust is the sharp parallel, borrowing the same ::<> spelling but using it only as the disambiguation fallback over default inference. The bound-erasure RFC has no inference either, but keeps the turbofish optional (omitting runs unvalidated) rather than required. Add a grid row (red cross for xphp and the RFC, both genuinely lacking inference) plus a short note capturing the mandatory-vs-optional-vs- inferred spread. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ully supported An honest pass over the feature grid: five rows were marked a plain green check but have real, documented caveats, so they now carry a warning sign with the caveat named in the cell and detailed in a new "Supported with caveats" section (each linking to the full write-up in caveats.md): - Generic closures / arrows: no $this capture, no `static function` closures, and reflection/serializers see the dispatcher rewrite. - Typed closure signatures: parameter/return/property positions only, not a generic argument or bound. - Generic functions / methods: no inference, and a turbofish can't forward a method-level parameter, target another generic template, or use static::/parent::. - Declaration-site variance: violations inside trait-used methods go unchecked; class-level only. - Real subtype edges: some covariant upcasts of erased method-generics are unschedulable, and self-reintroducing derivations may not converge — the celebratory subsection now points at this too. No cell moved between present and absent; the grid just stops overstating these five as caveat-free. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…compilers Honesty pass over the non-xphp columns, checked by compiling generic snippets in throwaway containers (TypeScript 7.0.2, Rust 1.97.1, Kotlin 1.4.10) rather than asserting from memory. The RFC column can't be run (no implementation exists) — its claims were checked against the RFC text. Corrections: - RFC "typed closure signatures" was a green check, but the bound-erased generics RFC has no structural closure/callable signature types (it lists them as future work). Now a red cross; PHP has only untyped callable / \Closure. (Verified against the RFC text.) - Kotlin reified T carried a plain check; `class Box<reified T>` fails with "only type parameters of inline functions can be reified", so it's now a caveat (inline fun only). (Compiler-verified.) - Generic enums: neither Kotlin `enum class` nor a TS `enum` can be generic (compiler-verified); both rows keep their check but note the real mechanism (sealed classes / discriminated unions). Everything else in the TS, Rust, and Kotlin columns was confirmed correct by the same compile checks — declaration-site variance, variadic tuples, union bounds, sum types, type aliases, associated types, use-site variance, reified/monomorphic T, and specialization-needs-nightly all behave as the grid claims. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The "Real subtype edges" bullet linked the caveat write-up for the array-backed-collection sub-problem but not for the self-reintroducing list-map derivation, even though that one also has a dedicated section in caveats.md (with a workaround). Add the missing link so a reader who hits the convergence error finds the fix. The unschedulable-upcast sub-problem stays unlinked by design -- it has no caveats section, only the inline error code. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b4a6a69 to
40bbcb7
Compare
An accuracy pass over the feature grid in
docs/guides/comparison.mdNo code changes; docs only. Nothing moved between "supported" and "missing"
in the wrong direction -- the grid just stops overstating features that work
but carry real caveats, and one cross-language mark that was simply wrong is
corrected.
xphp column
New row: type-argument inference. xphp has none -- the
::<>turbofish ismandatory on every generic call (omitting it is a compile error), unlike
TypeScript/Kotlin/Rust, which infer. Rust is the close parallel: same
::<>syntax, but there it is the disambiguation fallback over defaultinference. Marked absent for xphp, with a short note.
Five rows moved from a plain "supported" to "supported with caveats",
each with the caveat named in the cell and a new "Supported with caveats"
section linking the full write-up in caveats.md:
Generic closures / arrows: no
$thiscapture, nostatic functionclosures, and reflection/serializers see the dispatcher rewrite.
Typed closure signatures: parameter/return/property positions only,
not as a generic argument or bound.
Generic functions / methods: no inference, and a turbofish can't
forward a method-level parameter, target another generic template, or
use
static::/parent::.Declaration-site variance: violations inside trait-used methods go
unchecked; class-level only.
Real subtype edges: some covariant upcasts of erased method-generics
are unschedulable, and self-reintroducing derivations may not
converge (the celebratory subsection now points at this too).
Other-language columns
Checked by compiling generic snippets in throwaway containers rather than
asserting from memory: TypeScript 7.0.2, Rust 1.97.1, Kotlin 1.4.10. The
RFC column has no implementation to run, so its claims were checked against
the RFC text.
generics RFC has no structural closure/callable signature types (it lists
them as future work). Corrected to absent; PHP has only untyped callable
/ \Closure.
class Box<reified T>fails with "onlytype parameters of inline functions can be reified", so reification is
inline-fun-only.
enum classnor a TSenumcan begeneric (compiler-verified); both keep their check but note the real
mechanism (sealed classes / discriminated unions).
Everything else in the TS, Rust, and Kotlin columns was confirmed correct
by the same compile checks (declaration-site variance, variadic tuples,
union bounds, type aliases, associated types, use-site variance,
reified/monomorphic T, and specialization-needs-nightly).