4 ms·
The Clojure repl allows you to eval changes within a live application. Try that in PHP and I don't think you'll get very far.
by cutler 4y ago
The Clojure repl allows you to eval changes within a live application. Try that in PHP and I don't think you'll get very far.
- cess11 4y agoWhat do you mean by "live application"? Is a PHP application under nginx "live" or not? If it is "live", changing a file will immediately be reflected in the application on the next "eval", i.e. require or execution by the interpreter.
- klibertp 4y agoNope. That's not what the GP means. I'm not sure how it works currently with PHP, but what was meant was a long-running process that can change its behavior/be updated by evaluating new code without ever being restarted. Think of it like this: you have a page that never stops rendering, ie. you send some HTML but instead of finishing processing, you go into an infinite loop. "Live" system, in that situation, would still be updatable - you could change the body of the loop and make it produce another bit of HTML, without reloading the page. Again, I'm sure modern PHP was already optimized far from the initial "execute all the code on each request" model, but unless there's a long-running process that can be updated in memory without restart (and I don't mean doing `exec` on itself, that's cheating!) - it's not "live" by this definition. It's not that clear-cut a distinction, either. For example Elixir and Phoenix are definitely live, in that there's a process that responds to requests on one hand, and can be updated without restarting it on the other - but page reload is still required in many cases, even if triggered via websocket. This idea of liveness predates both PHP and the Web by 2 decades at least and comes from Lisp and Smalltalk. It's been incorporated by Erlang and later Elixir, and by Clojure. Other than that, some embedded scripting languages support this kind of development, for example Awesome WM is scripted in Lua, and you can evaluate arbitrary Lua code while it's running. Emacs is another system that is meant to be used this way. Good to read: https://gbracha.blogspot.com/2020/01/the-build-is-always-broken.html https://gbracha.blogspot.com/2020/01/the-build-is-always-bro...