-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Allow Windows line endings #582
Conversation
Treat '\r' as whitespace in the zig and the C tokenizer.
We will allow \r\n in C but not in zig |
@andrewrk Oh, ok. Sorry to hear that. On #574 you wrote
May I ask why? The implementation is very simple. It's not going to make the grammar more complicated. I can absolutely understand that you won't allow '\r' in the git repo. But in user code? |
There's a lengthy discussion on Zig's policy on line ending style and indentation style here: #544 Someone (probably me) should write a summary and put it in the docs. Until then, that thread is the best explanation. |
The way I see it, you have two choices: And frankly, if I had known that zig doesn't allow tabs for indentation, I would not have considered it. And I don't even use tabs. But this is a philosophy that has nothing to do with zen. It comes across as "we're right and everyone else should just accept that they're wrong", even on such a non-issue. All this is going to achieve is drive away people for no good reason. Especially considering how easy this is to implement. |
That's really all there is to it. This philosophy does have to do with the zen of zig: only one obvious way to do things. It's not about who's right and wrong; it's about making everyone do it the same way. |
It takes serious introspection to back out of a previously strongly held position so please consider that Windows users are - or will probably form - a majority of new users to Zig as it goes mainstream and that CRLF is the default line ending of this supported platform. Importantly, it's not just text editors that need reconfigured - I've never had any issues with git pulling as CRLF in the past, for example. Is the standing advice to memorize git commands to clone zig repos with different settings or make a global change to suit one language? I think reducing these points of friction would be the pragmatic choice and would increase the robustness, optimality and maintainability of the decision to use Zig on Windows. :) |
Treat '\r' as whitespace in the zig and the C tokenizer.