What is fexpr in php?

2019-09-20 12:11发布

问题:

What is fexpr in PHP? As I caught so far, It is a kinda function in Lisp language:

In Lisp programming languages, a fexpr is a function whose operands are passed to it without being evaluated.

I was reading an article which had deeply discussed PHP constructs, I faced fexpr there & Googling led me into the fact that it is fundamentally a Lisp concept!

That's why I can't clearly wrap my head around. Would you mind explain what fexpr is in PHP? and (if its semantically conceivable) Please provide an example & Use Case.

回答1:

Simply put - it's the thing that enables "functions" like isset() and empty() to accept possibly undefined variables.

That's only possible because they aren't actually functions, but language keywords (try declaring classes with those names, it won't work) recognized by the parser and then executed by the compiler. A regular function is executed at runtime.

If that doesn't answer your question, then you'd first need to understand what compilers and runtimes are ... I'm afraid that's too broad to explain here.

Other than that, I don't know Lisp, but I can only assume that "fexpr" is a prominent feature in that language. As in, you could possibly declare your own fexpr-essions - PHP doesn't have this; it just utilizes the concept for a few special cases.