Repository navigation
Symbols, strings or keywords for symbolic values? #2709
|
Hi there! First of all, thank you for all the hard work you put into Hy! It really is a joy to use. I'm a Scheme/Clojure hacker who reaches for Hy whenever they have to deal with Python libraries.1 I've been using it often lately since I write Python for a living. I figured I'd like to write more 'natural' Hy code (in the same vein as 'Pythonic', 'Rubyesque', 'Lispy' &c, if there's a Hy adjective), but there don't seem to be any established conventions that I can see, so I'm asking here: What's the canonical way of passing symbolic values between procedures?
What's the Hyish(?) way to do it? Footnotes
|
Replies: 1 comment 1 reply
|
And here I was thinking I was the only person in the world who did his thesis research in Hy. My standard recommendation is that, when in doubt, go for strings. This makes interoperability with Python easier and has more obvious semantics. In my own code, I tend to use symbols (quoted, if I'm not giving them to a macro that can do the quoting for me). I find this generally more readable than strings or keywords. The fact that models are not equal to unboxed Python values is, in fact, a feature (#2083). |
And here I was thinking I was the only person in the world who did his thesis research in Hy.
My standard recommendation is that, when in doubt, go for strings. This makes interoperability with Python easier and has more obvious semantics.
In my own code, I tend to use symbols (quoted, if I'm not giving them to a macro that can do the quoting for me). I find this generally more readable than strings or keywords. The fact that models are not equal to unboxed Python values is, in fact, a feature (#2083).