lisachenko / z-engine

:zap: PHP Engine Direct API
MIT License
448 stars 22 forks source link

Implement reflection function #15

Closed slifin closed 4 years ago

slifin commented 4 years ago

https://www.php.net/manual/en/class.reflectionfunction.php

Maybe it'll be possible to do lisp style repl driven development if we could redefine functions at runtime (assuming all other calls get redirected to the new revision of the function automatically)

lisachenko commented 4 years ago

Hello! As you can see, ReflectionFunction is already implemented in the source code (available at https://github.com/lisachenko/z-engine/blob/master/src/Reflection/ReflectionFunction.php).

This means that you can do some basic operation with functions, but PHP has two different internal structures for user-defined functions and internal function, thus implementation is partial. For example, you can not redefine an internal-function at the current moment, as it requires a little bit more work.

slifin commented 4 years ago

ah nice I should have checked the source