Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

haferburg
Copy link
Contributor

Treat '\r' as whitespace in the zig and the C tokenizer.

Treat '\r' as whitespace in the zig and the C tokenizer.
@haferburg
Copy link
Contributor Author

Cf. #581 #576 #574

@andrewrk
Copy link
Member

andrewrk commented Nov 3, 2017

We will allow \r\n in C but not in zig

@andrewrk andrewrk closed this Nov 3, 2017
@haferburg
Copy link
Contributor Author

@andrewrk Oh, ok. Sorry to hear that. On #574 you wrote

One thing we can do is allow crlf but replace them with zig fmt (when it exists)
that's why I implemented it.

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?

@thejoshwolfe
Copy link
Sponsor Contributor

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.

@haferburg
Copy link
Contributor Author

The way I see it, you have two choices:
∙ Provide plugins or configuration advice in a 'getting started' section for all major editors that deal with the line ending issue.
∙ Accept '\r'.

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.

@thejoshwolfe
Copy link
Sponsor Contributor

Provide plugins or configuration advice in a 'getting started' section for all major editors that deal with the line ending issue.

  • Notepad: not supported.
  • All other text editors: use Unix (LF) line endings.

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.

@paul-reilly
Copy link

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. :)

@haferburg haferburg deleted the line-endings2 branch January 13, 2020 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants