Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> PHP likes to pretend it's a dynamic language (Closures, for instance),

PHP is a dynamic(ally typed) language, and closures have nothing to do with static/dynamic.

> at its core it's a very strange dynamic/static hybrid

No, at its core it's completely dynamically typed, it got static features when it decided to base its OO on Java's.

> Which is why this doesn't work:

This doesn't work because PHP uses a shitty ad-hoc parser for a shitty ad-hoc syntax, much like closures it's completely orthogonal to the language being dynamic or static.

Also, this piece of code doesn't involve any closure. It looks like you don't know what a closure is.



>Also, this piece of code doesn't involve any closure. It looks like you don't know what a closure is.

Yes it does, it executes what PHP calls a "Closure": http://php.net/manual/en/class.closure.php


Actually, not really.

Your code breaks on any PHP "callable" http://php.net/manual/en/language.types.callable.php of which Closures are just one.


I'm well aware of that.

Although it seems PHP tried to treat it as a string callable IIRC.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: