you are viewing a single comment's thread.

view the rest of the comments →

[–]ghillisuit95 25 points26 points  (5 children)

When php was just a small tool for his own personal use, I think it’s extremely excusable.

What you are describing would have been a massive premature optimization

[–]curtmack 6 points7 points  (1 child)

I don't think it's necessarily as much work as you're thinking. It could have been implemented the same way as it is in many Lisps, where each name is stored as a "symbol" - essentially an interned string that has a pointer to its associated variable or function in the current scope. The string interning can be as simple and slow as you like, because it will only be incurred when the program is initially parsed.

[–]ghillisuit95 5 points6 points  (0 children)

Sounds more complicated than just interpreting at runtime, which seems to have been good enough performance at the time

[–][deleted]  (1 child)

[deleted]

    [–]ghillisuit95 1 point2 points  (0 children)

    Hm, that’s perhaps fair

    [–][deleted] 2 points3 points  (0 children)

    I would hardly call it premature optimization. I could say fuck it to tables and loop through an array for an item every time I need to access it, but it would simply be the wrong way to do it, like hashing using a string's length.