News for hackers. Stuff that matters.
Re:Ziglings: Learn the Zig programming language by fixing ti... by smallstepforman on Saturday February 13, 2021 @03:43PM (#26126679)
I’m interested in exploring Zig, but the draconian measure to ban hard tabs is pushing me (and many others from what I’ve read online) away from it. Andrew, get off your high horse, allow hard tabs, and we can all join hands and work together.
Re:Ziglings: Learn the Zig programming language by fixing ti... by anand-bala on Saturday February 13, 2021 @05:01PM (#26127392)
I think the whole point of picking a language standard is to prevent the "space vs tabs" debate. Andrew is trying to standardize the language formatting issues, similar to tools like `rust fmt`, `gofmt` and `black`.

The "Spaces vs. Tabs" argument shouldn't be what stops you from joining hands and working together :)

Re:Ziglings: Learn the Zig programming language by fixing ti... by simias on Saturday February 13, 2021 @07:34PM (#26128501)
I completely agree with you, I love not caring about formatting anymore. That being said, does this mean that zig refuses to compile code containing tabs? Because that seems a bit counterproductive to me.

A great advantage of rustfmt and friends is that I don't really have to care about my editor being correctly configured, I can just code without worrying about style and run rustfmt before comitting. But if the compiler outright rejects poorly formatted code it means that I have to run the format tool every time I want to compile or risk having my code rejected due to format issues. Now I have to care about my style again! It's the opposite of what I want.

I mean it's a very small issue and mainly a bikeshed, but that seems like an odd decision to me.

Re:Ziglings: Learn the Zig programming language by fixing ti... by anand-bala on Saturday February 13, 2021 @09:26PM (#26129121)
You have a valid point, but if the only formatting issue you will have is tabs, then running `zig fmt` on your codebase is pretty much a non-issue.

If your project is small, just run `zig fmt` on the command line.

If you have a large codebase, you can just incorporate it into your build process (similar to how clang-format and clang-tidy are used in CMake projects).

But again, if you have a large codebase written in Zig, you've probably already configured your editor to run `zig fmt` on save :)

Re:Ziglings: Learn the Zig programming language by fixing ti... by littlestymaar on Sunday February 14, 2021 @01:04AM (#26130072)
> But again, if you have a large codebase written in Zig,

At this point it means you're probably Andrew himself because the Zig compiler is the only large Zig codebase out there;)

Re:Ziglings: Learn the Zig programming language by fixing ti... by jorangreef on Sunday February 14, 2021 @02:15AM (#26130343)
Re:Ziglings: Learn the Zig programming language by fixing ti... by m45t3r on Saturday February 13, 2021 @09:06PM (#26129024)
You can just configure your editor to run formatter on save or with a shortcut. Not really a deal breaker.
Re:Ziglings: Learn the Zig programming language by fixing ti... by ymbeld on Sunday February 14, 2021 @04:55AM (#26130956)
“Refuse to compile” makes it sound like the compiler is able to but unwilling to compile the code. It could very well be that the parser doesn’t recognize tab as a valid token.
Re:Ziglings: Learn the Zig programming language by fixing ti... by zamadatix on Saturday February 13, 2021 @04:52PM (#26127322)
If tabbed indetation not being supported by the stage1 compiler is enough of a reason to not use a language it's probably best for zig to avoid those that would make this type of feedback and vice versa until stage2 and the language are stable (both support tab indentation, they just aren't finished).

I'm solidly in the tabs camp myself I just understand bikeshedding about this class of issue isn't what zig wants to/should be worrying about at the moment while core components are still being shifted around and written. In the meantime "zig fmt" runs as part of my build and life moves on.

Re:Ziglings: Learn the Zig programming language by fixing ti... by mssundaram on Saturday February 13, 2021 @04:36PM (#26127180)
You're saying this from atop your own high horse.

I used to fight about prettier (js) gofmt and so on. I just finally found I don't care. It's more fun to just code and watch it all get autoformatted to the project or language standard

Re:Ziglings: Learn the Zig programming language by fixing ti... by smallstepforman on Saturday February 13, 2021 @11:09PM (#26129593)
The reason hard tab people dislike code editors which convert to spaces is that pressing backspaces during editing removes one space, not all auto-inserted spaces. This ends up being very frustrating (since you need to press backspace 4 times). Most “used” languages allow both. Accept tab as another white space character and life goes on. Compile errors for hard tabs is a stubborn decision.
Re:Ziglings: Learn the Zig programming language by fixing ti... by dnautics on Saturday February 13, 2021 @11:20PM (#26129649)
> The reason hard tab people dislike code editors which convert to spaces is that pressing backspaces during editing removes one space, not all auto-inserted spaces

This is simply not the case for any editor I have used recently.

Re:Ziglings: Learn the Zig programming language by fixing ti... by sedatk on Sunday February 14, 2021 @12:19AM (#26129907)
In addition to this, "de-indentation" can be achieved with Shift-Tab instead of backspace.
Re:Ziglings: Learn the Zig programming language by fixing ti... by kortex on Sunday February 14, 2021 @08:46AM (#26132339)
Any editor worth it's salt will indent with tab and de-indent with shift tab with the cursor at the first non whitespace. Any good editor will de-indent with the cursor anywhere on the line.