![]() |
|
![]() |
| The "embed" part stems from the fact that you can mix Python and Hy in a project with bi-directional calling. Works great, because it is all Python byte code in the end. |
![]() |
| > this compiler is written in Python
Yes, that's right. Hy is not self-hosted. > The various ways you can embed a Lisp look very different and have very different tradeoffs. Hy itself provides options. Typically the process is that the Hy source code becomes Python AST objects, which Python then complies and executes, but you can also translate the Python AST objects into Python source text. Or you can use Python from Hy or vice versa: https://hylang.org/hy/doc/v1.0.0/interop |
![]() |
| At long last! Now I can finally clean up https://github.com/rcarmo/sushy (I've been poking at it over the years, but every time I upgraded hy portions of the syntax broke, or things would get moved in and out of the hyrule package, etc.)
By the way, Hy works really well inside https://holzschu.github.io/a-Shell_iOS on the iPad, although the syntax highlighting in vim/neovim needs to catch up to the 0.29+ releases and async. Although I've tried using Fennel and Guile instead over the years, having access to Python libraries and ecosystem is preferable to me, and with async I can do some very nice, efficient API wrangling (doing HTTPS with fine-grained control over socket re-use and headers remains a pain in various Schemes, so I very much prefer using aiohttp) |
![]() |
| https://hylang.org/hy/doc/v1.0.0/repl
>A convenient way to use this class to interactively debug code is to insert the following in the code you want to debug:
>Or in Python:
>Note that as with `code.interact()`, changes to local variables inside the REPL are not propagated back to the original scope. |
![]() |
| 1. I don't know what a breakloop is. Hy uses Python's exception system, which is more like a traditional exception system than Common Lisp's condition system.
2. No, sorry. |
![]() |
| Does Hy offer any features that Python lacks (e.g. dynamic binding)? I find the syntax of Lisp to be the least compelling of its many features. |
![]() |
| I enjoyed the less serious part a lot. I wish more programming related projects could embrace the whimsical. That might the best way to honor the python tradition in any case :) |
![]() |
| Strange, the Lisp example has a lot of syntax, even though the article claims it hasn't.
letrec, lambda, or & and are not functions in Scheme. |
![]() |
| Oh, thanks. He seemed so enthusiastic about Hy :-)
I just read through the author list on the Hy repo and had a glimpse into their blog posts. Cool stuff, great work. |
![]() |
| Hy-pothetically, yes, you could take Hy code in and spit Python code out via `hy2py`. I think at one point I considered supporting this officially, but then decided there was really no advantage. |
![]() |
| Great news, congratulations!
Years ago, under the influence of Lisp romanticism late into my university years, I worked on a domain-specific language for designing and analyzing control systems as my senior design project, using Hy! Just checked, it's been five and a half years to be specific. Really, time flies. Here it is for anyone curious: https://github.com/celaleddin/gently Since then, I've been following Hy from a distance and it's amazing to see it's still active. Thank you everyone involved! |
![]() |
| Any downsides to using Hy (over Python)? Other than my coworkers don't know Lisp?
More concrete: Are there Python language features I can't use in Hy? Or performance penalties in using Hy? |
![]() |
| Super happy Hy 1.0 has been released! It was the first proper open-source project I contributed towards and I don't think I would have been as engaged as I am in the community without it. |
Also, looking at the code on Github suggests this compiler is written in Python (see https://github.com/hylang/hy/blob/master/hy/compiler.py).
I kind of wish this was made more clear on the main website. Perhaps, instead of introducing Hy as "a Lisp dialect that's embedded in Python", introduce it as "a Lisp dialect that compiles to Python's AST". The words "embedded in Python" don't make it very clear just how it's embedded into Python. The various ways you can embed a Lisp look very different and have very different tradeoffs.
For example, off the top of my head, I could "embed" a Lisp by writing an interpreter (in C if I care about performance) and letting it be called from Python, perhaps passing in a Python list instead of a string to make it more "native". Or I could "embed" a Lisp by compiling to Python bytecode. Or I could "embed" a Lisp by translating it directly to Python source code. Etc.
Regardless, interesting project!