Closed girvo closed 12 years ago
Pharen does have closures, however to stay compatible with PHP 5.2 they're implemented as 2-element arrays. Pharen can handle this fine, but for other PHP functions there's no official way on how to manage this problem. There's a possible way to fix this by making a macro, so I'll keep this issue open so that I can come back and write more here later.
Besides a macro, another long-term fix would be to tell the compiler that when PHP 5.3 is used it can use PHP's own anonymous functions or the ability to use objects as callables.Otherwise just naming the functions should work for now.
hi Scriptor, i have made a fork of pharen that support form of php 5.3 closures and namespace and foreach. I have also splitter this in external plugin.
You can see at this link: https://github.com/francescoagati/pharen
example of closures: https://github.com/francescoagati/pharen/blob/master/examples/plugin/plambda.phn
example of namespaces: https://github.com/francescoagati/pharen/blob/master/examples/plugin/namespace.phn
example of use: https://github.com/francescoagati/pharen/blob/master/examples/plugin/use.phn
Use of plambdas should fix this for now:
(-> app (get "/" (plambda () ))
Hey there, loving Pharen so far, lots of fun!
I'm trying to tie it to the Slim framework, so far so good, but when defining routes I can use php like this:
And as far as I can tell, there is no way of doing that in Pharen. If there isn't, that's okay, close this issue, as I can just name the function anyway, but I was curious.