5 ms·
There are hundreds of changes listed here and still no mention of fixing the fact that zig purposely errors out on tabs and carriage returns. This might sound
by BubRoss 7y ago
There are hundreds of changes listed here and still no mention of fixing the fact that zig purposely errors out on tabs and carriage returns. This might sound too ridiculous to believe, but if you use tabs or save a file out of windows text editor with normal settings, zig just won't compile. It would be trivial to do what every other compiler in history does, but they want to screw with windows users or anyone you uses tabs for some philosophical reason.
- htfy96 7y agoNim also disallows tab: https://play.nim-lang.org/#ix=2hW9 https://play.nim-lang.org/#ix=2hW9
- platinumrad 7y agoAs does F#.
- dbsights 7y agoThis is the reason I can't stand zig: its so aggressively opinionated about something that doesn't matter at all.
- zamadatix 7y agoRun "zig fmt" before "zig build-exe" and it's not a problem. Even Notepad supports unix line endings these days.
- BubRoss 7y agoOr zig could do what every other compiler does and work by default. Why would I invest time in a user hostile language?
- zamadatix 7y agoEver used or read about Fortran, Haskell, or Python? The idea that whitespace does not matter and will just be handled as-is is and has been a language design choice before and after Zig regardless how many times you pose the question. That Zig or any other language did not make the choice to treat whitespace the way you'd prefer in the compiler and instead left that it to the formatter does not make them "user hostile". The Zig docs link to the reasons they made the choice not to support varying whitespace (and other character and syntax choices), if you don't like those reasons feel free not to use it but it's a bit rude to make it out like they did it to "screw Windows users" when it's neither technically true nor the actual motive. This is all coming from a guy who has only messed with Zig on a Windows box with a preference for tabs over spaces (except post indent alignment). Zig fmt works great, haven't had an issue, less difficult to get going than mingw or vs that's for sure.
- BubRoss 7y agoFirst, I said screw with windows users. Second, none of those languages error on carriage returns. Third, whitespace being significant is not the same as erroring out when your users don't use your preferred white space. I don't use tabs for anything, but it is all trivial to handle and they bomb out anyway. It's a slap in the face to users and it's "rude" to waste people's time by making them deal with nonsense. It is not "rude" to point out that a piece of software does this. Also none of what you put here is an an actual justification for stuff like this. This is like being in the twilight zone, why would anyone defend this?
- zamadatix 7y ago"With" or not with you don't find it a bit ridiculous to say that a group designed a C compatible language that can cross compile to/from Windows easier than any existing C compatible language to this point yet they specifically chose the whitespace as they did because they want to screw with Windows users - no better reason? Again Unix newline style is the least of the worries for whitespace, Windows and built-ins like Notepad handle it just fine for years now if that's what you code in. Try inserting tabs in place of spaces as you please in Python or Haskell though and yes you are likely to run into problems trying to run a program. It's not called "significant whitespace" in those languages because it's ignored. It's fine to point out you think something is harder to use than it needs to be but the way you've done it says more about you than the language. You won't a whole language because it requires you run the built in formatter to compile? Might as well not use GCC either it forces you to use -- for options instead of / and other tools handle it just fine they just want to screw with Windows users that's it! What's left to talk about except these kind of nitpicks if that's where you draw the line for ignoring whole projects with years of effort put in them at? None of what I put here was claimed as justification I said the Zig docs link to the reasons. Specifically (in case you'd rather I'd bring them up for you) the reasons were around ease of parsing as a large portion of the syntax was. The whole language specification is actualy very specific about making sure each line can be simply tokenized individually and parsed one way regardless of convetion - not actually so picked just to screw with people that like tabs or Windows. Zig fmt is allowed to "eat" any complexity in normalizing code (referencing ICU data, normalizing whitespace and other syntax, and so on) so zig build-exe doesn't have to. This philosophy of keeping as much functionality out of the core compiler and language is a big part of what allows Zig to target many places e.g. Rust doesn't even though Zig is still very fresh. If running "zig-fmt" as part of your custom build process or using one of the editor plugins ziglang maintains that does this for you is "a slap in the face to users" I'm not sure there is any language those users would be happy with as there are other things they are going to like less than it replacing their whitespace on them. It's certainly not harder to do than post scathing reviews about how you couldn't just use tab on the release discussions though.
- PeCaN 7y agoWhat the fuck It's kind of funny to me though that there's an actual language out there where you can do use-after-free and all sorts of other C-level stuff but can't use tabs.
- deleted 7y ago[deleted]
- AnIdiotOnTheNet 7y agoIt is consistently surprising to me how many people bikeshed this particular decision. Zig has taken an aggressive stance on many things. For instance, it has no default allocator, no compiler warnings, variable shadowing is a compile error, no function overloading, no operator overloading, etc. And all of these decisions have pages and pages of discussion and justification. But hey, let's keep talking about the one that is the most trivial.
- BubRoss 7y agoBreaking by default for no other reason than because you think windows 'does it wrong' is not bikeshedding something trivial. Think about this. You tell your supervisors to check out zig. They ask why it doesn't work with the small program and compiler options they copied from the website. How would you explain that to them? Are you going to try to convince them that ignoring a character is a problem and that the time they spent wondering why it doesn't work is justified?