3 ms·
Nitpick: Closures are a 5.3 feature. The fact is, this is a fancy, but horrible way to construct your objects if you care about performance at all. It also bre
by phpnode 15y ago
Nitpick: Closures are a 5.3 feature.
The fact is, this is a fancy, but horrible way to construct your objects if you care about performance at all. It also breaks things like typehints, instanceof, inheritance etc.
- Udo 15y agoThanks for the correction. Sometimes new things feel like they've been around for an eternity ;-) I absolutely agree with you, that's basically why I wrote the comment. Just looking at their PHP code, you can sometimes see very clearly in what language people were thinking at the time. Some people try to emulate Java, JavaScript, even C or C++ sometimes. It's always horrible.
- exDM69 15y agoIf we forget about PHP for a while, I really like this way of constructing objects by using dictionaries (or environments or hash tables) and closures. In fact, I would prefer that in a dynamic language, it would be the only way of constructing objects. I don't see much point in having classes in a language like Javascript, PHP or Python and I almost never use inheritance in these languages. Stuff like instanceof is a bad match for duck typing. Single dispatch method invocation adds very little value to a language that is already ducktyped.