4 ms·
I want to like Zig but after trying a couple programs it has a few annoying nuances. I believe you can't use tabs which is overly opinionated and the odd print
by encryptluks2 4y ago
I want to like Zig but after trying a couple programs it has a few annoying nuances. I believe you can't use tabs which is overly opinionated and the odd print requirement to use empty brackets is overly verbose.
- stephc_int13 4y agoAnd all the dots.
- trgt 4y agoZig 0.10.0 allows tabs. I think 0.9.1 also allowed, but I'm not 100% sure.
- encryptluks2 4y agoWhen I use tabs I get "./fizzbuzz.zig:4:1: error: invalid character: '\t'"
- pverghese 4y agoI think any text editor can convert tabs to spaces. I've never had this issue for any number of languages
- frou_dh 4y agoSomething I found eyebrow-raising is that the expected type of expression `x` in `if (x) { ... }` actually changes based on what syntax is used on an `else` line that comes later.
- eatonphil 4y agoI haven't seen that yet. Could you give an example?
- frou_dh 4y agoIIRC in the following, the expected type of `x` in B stops being bool (but I no longer have a Zig env set up so I can't test it). # A if (x) { ... } else { ... } # B if (x) { ... } else |y| { ... }
- hansvm 4y agoThat looks right. If/else is overloaded as doing the normal thing with bools by default, and if you try to capture something exceptional with `else |y|` then the type of `x` is inferred to be something capable of such a capture -- optionals or error unions.
- frou_dh 4y agoIn a statically typed language, this specifically comes off to me as an artificial way to keep the total number of keywords down.