Readit News logoReadit News
Kodiologist commented on Google.com search now refusing to search for FF esr 128 without JavaScript    · Posted by u/superkuh
Kodiologist · a year ago
I got it to work again with a user agent from Links: `Links (2.29; Linux 6.11.0-13-generic x86_64; GNU C 13.2; text)`.
Kodiologist commented on Hy 1.0 – Lisp dialect for Python   github.com/hylang/hy/disc... · Posted by u/Kodiologist
ashton314 · a year ago
Yes, and it's a very nice tutorial! I'm interested in implementation details. Maybe there's no hygiene (and no scope sets etc.) to worry about—that would probably make documentation a little shorter. I'm sure the documentation will grow as people run into edge cases.

(I'm also probably a little spoiled with documentation coming from Racket which has like 4 big chapters dedicated to different aspects of macros scattered around the docs, plus some associated papers. Forgive me—I'm not trying to dunk on Hy; I just like reading docs.)

Kodiologist · a year ago
Admittedly, I've tried not to document the implementation. Yeah, they're pretty much simple dirty Common Lisp macros. Internally, they're functions that are called with the arguments converted to models (via `hy.as-model`), and then the return value is converted to a model. If a macro's first parameter is named `_hy_compiler`, it gets access to the current compiler object; this is undocumented since it's only meant for internal use. Reader macros have no parameters, but can access the current reader object as `&reader`. When it's defined, a reader macro is added to the current reader's dispatch table.
Kodiologist commented on Hy 1.0 – Lisp dialect for Python   github.com/hylang/hy/disc... · Posted by u/Kodiologist
mcejp · a year ago
I would like to make the observation that as Hy matured over the years, instead of accumulating syntactic sugar and special cases to grow more Lispy, less Pythony, it seems to have generally gone the opposite way. That is, becoming a thinner syntactic abstraction of Python's feature set, focusing on the essentials that cannot be emulated in any other way (macros)

A few examples from recent releases:

- "match" is just native Python "match" -- it doesn't even polyfill for pre-3.10 Python versions (in the TypeScript world this would be unthinkable)

- "foo?" used to mangle to "is_foo" as a special case, but this has been removed

- "hy.eval" has been overhauled to be more like Python's "eval"

- nice-to-have but non-essential utilities ("unless") get often pushed out into the Hyrule package

For me this direction was counter-intuitive at first, but it has some very nice outcomes; for one, it simplifies the learning curve when coming over to Hy from Python, and it makes it easier to consistently interact with Python packages (arguably the main reason to use Python in the first place!)

Or maybe it's just a matter of simplyfing maintenance of the language; IIRC, "let" took like 4 attempts to get right :)

In any case, congratulations on this great milestone!

Kodiologist · a year ago
Yeah, at a certain point I realized that both the maintenance and the use of the language became much slicker if unnecessary deviations from Python were minimized. After all, when I'm writing Hy code, I'm usually spending a lot more time referring to the documentation of Python or third-party Python libraries than the documentation of Hy. I felt there were a number of ways Python could be improved upon, but e.g. the old feature that let you spell `True` as `true` in deference to Clojure was just a needless complication.
Kodiologist commented on Hy 1.0 – Lisp dialect for Python   github.com/hylang/hy/disc... · Posted by u/Kodiologist
aitchnyu · a year ago
Does it (or other lisps) interact with Python static typing?
Kodiologist · a year ago
You can add all the same type annotations as in Python, but from what I've seen, type-checkers expect Python source text and don't just use standard Python introspection, so you'll need to use `hy2py` first to actually check your program's types.
Kodiologist commented on Hy 1.0 – Lisp dialect for Python   github.com/hylang/hy/disc... · Posted by u/Kodiologist
mark_l_watson · a year ago
Wonderfull!

I wrote a book oh Hy, so now tomorrow I will update all the examples to version 1.0

Not counting work on my book, I don’t use Hy more than perhaps five hours a month, but it is a fun language, with good Emacs support. Thanks!

Kodiologist · a year ago
You're welcome. There are no actual breaking changes from 0.29.0, so you're already up to date if you got that far.
Kodiologist commented on Hy 1.0 – Lisp dialect for Python   github.com/hylang/hy/disc... · Posted by u/Kodiologist
aidenn0 · a year ago
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.
Kodiologist · a year ago
Yes, such as: metaprogramming via macros and reader macros; arbitrary compile-time computation; removal of restrictions on mixing statements and expressions; and other arities for Python's binary operators. See http://hylang.org/hy/doc/v1.0.0/whyhy#hy-versus-python

Dynamically shadowing global variables is not built-in, but easy to write a macro for if you want it. See e.g. https://stackoverflow.com/a/71618732

Kodiologist commented on Hy 1.0 – Lisp dialect for Python   github.com/hylang/hy/disc... · Posted by u/Kodiologist
ashton314 · a year ago
Yay! The birth of a language is a beautiful thing.

I’m curious about the macros: how are these implemented? They seem like pretty straightforward unhygienic Lisp macros, which is a little bit of a disappointment, but better some macros than none at all! Anything about the macro system that distinguishes it from the Common Lisp system? E.g. anything borrowed from Scheme or Racket? Docs are sparse here.

Kodiologist · a year ago
Sparse? I got a whole chapter for ya: https://hylang.org/hy/doc/v1.0.0/macros
Kodiologist commented on Hy 1.0 – Lisp dialect for Python   github.com/hylang/hy/disc... · Posted by u/Kodiologist
libbrfish · a year ago
I'm wondering, is it worth learning Hy if I don't know any python? (coming from a clojure background) Or is python knowledge a prerequisite?
Kodiologist · a year ago
Learning Python is not required to get started and do some simple stuff, but it is effectively required to master Hy.
Kodiologist commented on Hy 1.0 – Lisp dialect for Python   github.com/hylang/hy/disc... · Posted by u/Kodiologist
nikisweeting · a year ago
I remember Hy! It blew my mind back in 2014 and is still cool today, it's great to see it still going and congrats on releasing 1.0.0!

Also great timing after the recent Python Preprocessor post: https://pydong.org/posts/PythonsPreprocessor/

Could Hy hypythetically be implemented as a preprocessor like https://github.com/tomasr8/pyjsx?

Kodiologist · a year ago
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.
Kodiologist commented on Hy 1.0 – Lisp dialect for Python   github.com/hylang/hy/disc... · Posted by u/Kodiologist
Foxboron · a year ago
and for those interested in history, Docker was first announced 10 minutes afterwards on the 26:24 mark.
Kodiologist · a year ago
Now I know how those guys felt who were on the same episode of Ed Sullivan that introduced the Beatles.

u/Kodiologist

KarmaCake day292May 3, 2022
About
http://arfer.net
View Original