Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

function - What is fexpr in php?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...