From 630bf170ead85cfce5de05902357a31675917580 Mon Sep 17 00:00:00 2001
From: Emiel Bruijntjes
- PHP uses magic methods and + In PHP scripts you can use magic methods and magic interfaces to add special behavior to - classes. With C++ you can achieve the same, but by using technologies like + classes. With C++ classes you can achieve the same, but by using technologies like operator overloading, implicit constructors and casting operators. The PHP __invoke() method for example, is more or less identical to operator () in C++. The question that we asked ourselves was whether we should automatically @@ -17,18 +17,22 @@
We have decided to follow the PHP conventions, and use magic methods and magic interfaces in C++ as well - although we must admit that having - methods that start with two underscores does not make the code very + methods that start with two underscores does not make the code look very pretty. But by using magic methods the switch from PHP to C++ is kept simpler for starting C++ programmers. And on top of that, not all magic methods and - interfaces could have been implemented with core C++ features, so we did have - to use some magic methods and/or interfaces anyway - so we could just - as well follow PHP completely in this. + interfaces could have been implemented with core C++ features (like operator + overloading), so we had to use some magic methods and/or interfaces + anyway. That's why we decided that because we had to use _some_ magic methods + in C++, we could just as well follow PHP completely and support _all_ magic + PHP methods in C++ too.
- Besides the magic methods and interfaces that are also available in PHP - user space, the Zend engine has additional features that are not exposed via - magic methods, and that only are accessible for extension programmers. These - features available for extensions built with PHP-CPP. + Besides the magic methods and interfaces that are available in PHP + user space, the Zend engine has additional features that are not exposed to + PHP user space scripts. Features that are only accessible for extension + programmers. The PHP-CPP library also supports these special features. This + means that if you use PHP-CPP for writing functions and classes, you can + achieve things that can not be achieved by writing pure PHP code.
-- cgit v1.2.3