Re: [PHP-DEV] P++: FAQ

  106514
August 9, 2019 22:42 pollita@php.net (Sara Golemon)
On Fri, Aug 9, 2019 at 4:30 PM Mark Randall <markyr@gmail.com> wrote:

> On 09/08/2019 22:02, Sara Golemon wrote: > > 2. Strict(er) typing - I'm not sure, on the surface, what future > expansions > > we'd plan for in this area which couldn't fit into standard PHP in a non > > BC-breaking way. > > Union types and general reflection do spring to mind on this. I assume > any APIs using them would need to return more complex objects describing > them, rather than individual strings from getType(). > > Or maybe a string from getType() and an object from getTypeAnnotation() ?
> Typed arrays are also another one which has been in high demand that I > imagine will present some BC issues if shared between stricter and > less-strict code. > > I don't see these (or Generics which you also mentioned) as being inherently incompatible between more/less strict codebases.
Say we have an array or ValueObject in "more strict" code, we could refer to an unspecialized version of that as merely "array" or "ValueObject" in "less strict" code. Or even not refer to its type at all. Without a formalized proposal for how these are implemented, I'm not sure we can assume there will be technical challenges which we simply can't overcome. My point being, I'm not sure these things necessarily require a schism. We should be certain they do before we invest much time in figuring out the how of it. -Sara