A PHP internals mailing list discussion revisiting the idea of typed closure signatures in PHP, e.g. `Closure(int, string): array`, enforced at type boundaries. The thread covers the history of prior RFCs (Callable Prototypes 2016, Structural Typing for Closures 2023), debates whether to scope it to Closure only vs. callable, why generics are not a substitute (variadic generics would be needed and are years away), the tradeoff between inline syntax vs. named delegate/alias approaches, and how C#'s evolution from reference-only delegates to Func/Action illustrates why inline syntax is the necessary primitive. Key contributors include Larry Garfield, Rowan Tommins, and others, with general consensus that inline typed closures are worth pursuing independently of generics and type aliases.

22m read timeFrom externals.io
Post cover image
71 Impressions