-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove true/false in favor of True/False (or the reverse?) #908
Comments
Alternate Proposal: Obviously incompatible with the above, but I do think we should pick one or the other. I like the status quo least of all. As pointed out in the discussion of #899, Python keywords don't have to be reserved in Hy. Hy can be set up to treat This has the advantage of keeping what appears to be the more popular alias. |
I like the alternative better. :) I was never much of a fan of Python's uppercase |
A third option from #1119: Remove both pairs and use There's plenty of precedent for @hylang/core, what say you? |
For what it's worth, I think |
My preference would be |
IMO Personally, I'm missing |
So it looks like folks' preferences are:
I think |
Per discussion in hylang#908. True and False are still allowed. Allowing users to use these as variable names is probably more trouble than it's worth, and I figure this helps to smooth over human translation from Python code to Hy. It might be a good idea to use T and F consistently in Hy's own code, not to mention the documentation. (This preference could be stated in the style guide.) I added a bit to the documentation about the correspondences between True, False, None, and their synonyms because this didn't seem to be documented at all.
I for one think that single-letter uppercase symbols are really ugly, and i've never seen those used anywhere else. I think that removing the Basically I think this issue should be closed doing nothing. |
I'm on the same side as @olasd. |
Same here. T/F are ugly and make no sense. |
Wow, The conciseness is also nice. I do think that things that get used a lot should have concise representations. With a short representation like For most other uses of Booleans, I'd expect to see computed values more often, like I doubt this will change anyone's mind (but if it does, speak up!), so I'm going to consider the But all that said, I think it's more important that there be one-- and preferably only one --obvious way to do it. This is a good principle for many reasons, including ensuring that Hy users speak a mutually intelligible dialect. If we had started with only Python's style If we had started with only Clojure's style The Clojure option seems to be the de facto status quo. Does anyone seriously dispute that even if Hy allowed both Clojure and Python style, then future Hy style guides would eventually settle on one or the other? Then why not just enforce it at the compiler level? |
Vote for the de facto Clojure-style |
Vote for the default Python-style |
@hylang/core The above is more of an opinion poll than any kind of binding decision process, by the way. We can still discuss the details of how to implement whatever we decide on. |
If we're not doing
I don't know about Ruby, but the only two-character names a Perl programmer needs to know are I've noticed Python programmers talk about Perl a lot, usually as an example of what not to do, but it seems that most people who complain about Perl don't know it very well in the first place. |
Per the straw poll in hylang#908, as an alternative to hylang#1147. Now you must use `True`, `False`, and `None`, as in Python. Or just assign `true` to `True`, etc.; the old synonyms aren't reserved words anymore.
I was including operators, actually. Ruby also has some arcane global names. ( It's not like I know Perl well enough to hate it. Learning more Perl is actually on my to-do list. Any recommendations for good textbooks or something? Should I look at Perl 6 first? Or at all? It doesn't seem ready, and hasn't for a very long time. |
That poll is actually really close. I thought we might see some kind of consensus, but it looks more like a stalemate. I feel like we need some kind of decision process to keep progress on Hy from getting stuck like this. Do we just go with @paultag's vote? Does anyone know a system that works really well from your other projects? |
If it comes down to a deadlock tie, I'm going to make the following argument:
Therefore:
If folks feel strongly enough that the above isn't going to be enough to gain consensus, we'd be at our first deadlock as a project. Which is both great (yay!) and not great. I don't want to do the BDFL thing if I can avoid it, but I'm happy to. It's worth stating, if I had to make a call, it would be to gut all aliases of |
@gilch Years ago, I was a Perl 6 developer, but I eventually lost interest when I felt it simply wasn't getting anywhere. The odds were too far against it from the start because of the sheer variety of features that were desired for the core language. It's a victim of the second-system effect (even though Perl was big and ugly (and proud of it!) to begin with). Perl 5 is still alive and well even though it's much less popular than it was in previous decades, presumably from competition with Python, Ruby, PHP, and even JavaScript now that server-side JS is a thing. The famous camel book, Programming Perl, deserves its good reputation. You might also want to check out Modern Perl. I haven't read it, but I understand that it makes a clear case for how Perl ought to be used in modern times, in contrast to the troublingly common practice of writing Perl in the 2010s as if it were the 1990s (using Back on topic. Ideally all serious Hy users would show up here and we could poll them all, but since that's not happening, I guess we should give Paul the deciding vote. Besides, this is clearly the sort of ugly bikesheddy issue where reaching a decision at all is more important than what choice we make. |
@Kodiologist Thanks, I'll look at Modern Perl then. It was actually my best guess about where to start. @paultag Thanks for that weigh in. I think that argument gives us some good direction for other issues too. |
ref #240, where the discussion has become too unfocused to make much progress. Let's pick apart the remaining subissues one-by-one.
I'll admit to using the easier-to-type aliases
true
/false
almost exclusively in my own code, and they're used a lot in Hy proper. But I still think this is extra complexity for marginal benefit.Python keywords are reserved in Hy (they don't have to be, see discussion in #899), because Hy compiles to Python and can be imported from Python. They don't have to mean the same thing in Hy as in Python, though this can get confusing.
def
(for example) has a pretty different meaning, but there's no other good meaning forTrue
andFalse
that we could use instead.True
/False
/None
are reserved in Python3. They cannot be assigned to in Python. It may be problematic (though possible) to allow this in Hy, and besides We're Still Python(TM). Thus, if we have to choose, the clear choice is the Python words.I am unconvinced by the argument that
true
andfalse
are easier to type.True
andFalse
literals are actually not used as much as you might expect. Sure, Booleans are used all the time, but usually you type in an expression that evaluates to a Boolean rather than forcing one or the other yourself.The case where Boolean literals get used the most is in testing. If you're testing at the REPL and just need a generic truthy or falsey value, then, admit it, you're going to use
1
and0
over eventrue
andfalse
, because it just does not get any easier to type than that.Unit tests, on the other hand, also serve as a kind of documentation. It's worth making them readable. Now if we decide that it's idiomatic in Hy to use
1
/0
for unit tests, then people will be used to it and it will not be considered hard to read. (Many of Hy's unit tests already do this by the way.) On the other hand,True
andFalse
are no less readable, and they even stand out more.I am also unconvinced by the argument that
true
andfalse
are used all the time. It's a simple one-line fix:The other keywords we've removed breaks stuff a lot harder than this. Yes, the Grand Language Cleanup will break stuff. Best get it over with now. If removing
true
/false
turns out to be a mistake, it will be an easily correctable mistake. If NOT removingtrue
/false
turns out to be a mistake, it will only get harder to fix.The text was updated successfully, but these errors were encountered: