-
Notifications
You must be signed in to change notification settings - Fork 101
Home
Want to get started using or contributing to pestle? Start here.
Need help understanding how to pass arguments to your program? Read the arguments and options document
Pestle grew out of my desire to write PHP in a "python like" way. That is, to have
- A non-default-global namespace
- The ability to import functions from other modules
- The ability to import all functions from other modules
- Small functions operating on scalar and list data
When PHP announced namespaces in PHP 5.3, I was initially excited. However, PHP 5.3 namespaces didn't have great support for functions. They understood functions, but the use
keyword only worked with classes.
More modern versions of PHP (5.6+, 7.0) introduced the use function
-- but this only works with already loaded PHP code files. i.e. you'd need to load all your module files at once. PHP solves this with classes using the SPL autoloader, but registered autoloaders don't fire for undefined functions. The use
function is also missing the ability to load all the functions from a namespace. i.e. similar to python code that looks like this
import time;
print time.time();
PHP's evolution towards a class/interface based programming system is probably the right one for widespread adoption and business support, but I've always been curious what it would be like to work with PHP if it had gone the other way. That's part of what the pest project is about.