I had a very strange experience the other day, I found myself wanting to reach for PHP.
I spent many long years as a PHP programmer, so part of it was muscle memory, but then I realized part of it was a real strength of PHP. I wanted to collect some email addresses from folks, and I really didn't feel like compiling a static binary and worrying about the libc version and chosing a port and copying a systemd file and creating an nginx virtual host. None of those steps are particularly hard, mind you, but you have to have an app so it's worth it, not a snippet or a throwaway script. But then again, snippets and throwaway scripts are often the beginnings of great apps!
The thought of typing something like $_SERVER["HTTP_HOST"] cured my predicament rather quickly, but I noticed I was onto something. I've been doing the nginx-and-systemd dance a long time, but if you're just starting out, it's really powerful if you can just type "echo" and then read something in the browser. I'd just discovered the mummy webserver and it was just so clean, and I'd looked into nimcr for scripts... and I was like, I wonder if I could put these together. Shouldn't take more than a day or two.
Well, it took a bit longer than that, but now you can easily take some source code and put it into mummy, and keep most of the performance! And the source... of a mummy... is a pharao. And pharao start's with PH, like PHP. It was meant to be.
There's lots of examples and instructions on how to set pharao up in production in its repository:
https://github.com/capocasa/pharao
But if you just want to give it a spin on your computer, do this:
$ nimble install pharao
mkdir www
pharao -W:www
# www/foo.nim
echo "I have been entombed"
And now open localhost:2347/foo.nim in the browser, and I hope that you, too, will have been entombed.
And the source... of a mummy... is a pharao. And pharao start's with PH, like PHP. It was meant to be.
Yeah, I can relate. Name based development is all I'm doing... Lexim, Ormin, Karax, Malebolgia, Atlas, Nimony, ... :-)
Interesting read! Unfortunately I don't quite get it, source code filters (SCF) don't imply global variables, iirc. How did AI translate them for you? Into what? Your post lacks concrete code snippets to understand.
PS: SCF are not going anywhere, even Nimony supports them already.
Thanks!!!
Original pharao used parseStmt to compile a pharao program, put the imports into module scope and the rest into a procedure, compile it to a shared library, load it into the pharao daemon, and run it (only the last step when cached).
But parseStmt doesn't support SCF, so I came up with this ugly hack of using a typed macro to have a replacement that does. What I didn't realize was that the typed macro binds the variable scope to global when it loads the file, and wrapping it in a procedure doesn't change that. So I had devised the possibly least thread safe system in history.
So I asked the AI if it could extract the SCF code into a library, and it just re-wrote it with strings. So now pharao is back to the original parseStmt plus the the scf transform from the new nimble library if needed.
"SCF are not going anywhere, even Nimony supports them already."
good to hear! SCF are a big part of my whole life. lol
SCF are not going anywhere, even Nimony supports them already.
good to hear! SCF are a big part of my whole life. lol
Yes! I also let out a small Yelp of joy when I heard.
For pharao use, I had the code extracted into its own nimble library- I wonder what else it could be used for! Nim-based languages?