On Thu, Jan 4, 2018 at 7:21 PM Rasmus Lerdorf <ras...@lerdorf.com> wrote:

> > On Jan 4, 2018, at 13:09, Andreas Hennings <andr...@dqxtech.net> wrote:
> >
> > A system where all variables are type-locked could in fact be faster
> > than a system with dynamically typed variables.
> > Depends on the implementation, of course. I imagine it would be a lot
> > of work to get there.
> I think you, and many others, commenting here, should start by looking at
> the engine implementation. Any successful RFC needs to have a strong
> implementation behind it, or at the very least a very detailed description
> of how the implementation would mesh with the existing engine code.
> The reason we don’t have typed properties/variables is that it would
> require adding type checks on almost every access to the underlying zval.
> That is a huge perf hit compared to only doing it on method/function egress
> points as we do now.

I’ve been thinking on this during my drive today to a new job and city. I
promise to read over the current implementation before going further, but a
quick question - what if the underlying zval wasn’t a zval but a separate
class specific to the data type but implementing the same interface as
zval? The compiler would choose to use the alternate classes when it
encounters new syntax calling for their use, in effect adding a static
typic layer that augments the existing dynamic typing layer.

> -Rasmus
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to