4 ms·
Well, compared to what? Zig is much nicer to read than Rust or C++, about the same as Typescript, but not as nice as modern C. But that's just my opinion. Suc
by flohofwoe 2mo ago
Well, compared to what? Zig is much nicer to read than Rust or C++, about the same as Typescript, but not as nice as modern C.
But that's just my opinion.
Such questions usually come down to "how familiar am I with this programming language", and anything that doesn't look like your pet language looks ugly. Except Rust and C++ of course, those are objectively ugly ;P
- phplovesong 2mo agoOfc it boils down to familiarity. But making a custom version of, say structs is just a weird design. The mainstream struct syntax is something everyone knows, and zig made all kinds of weird decisions around it. Same goes for @SpecialThing, looks like PHP to me. Multiline strings are also a weird addition. The list goes on.
- flohofwoe 2mo ago> But making a custom version of, say structs is just a weird design. This I don't understand? Zig structs are pretty much the same as in any other language, except that the declaration can be more flexible by building the struct type via comptime code (e.g. how Zig does generics) - and Zig groups structs and namespaces under the same keyword (which hardly matters in practice though). > @SpecialThing ...not any weirder than `__builtin` keywords in Clang or GCC and at least in Zig it's obvious that anything starting with a `@` is a builtin, while in Clang/GCC the `__` is not explicitly reserved for builtins. ObjC also uses a leading `@` to separate ObjC keywords from regular C keywords. Agreed that the @-noise can get a bit excessive in Zig though (mainly because implicit casting is heavily restricted, at least compared to C). > Multiline strings are also a weird addition AFAIK the 'weird' multiline syntax is for keeping the parser simple and fast. Multi-line-strings themselves are a good feature to have though. In general, if Zig code starts to look too 'noisy', that's usually a sign that the code should be simplified. I definitely don't agree with all design decisions in Zig, but the syntax is mostly fine (my main critique points are that Zig often tries to lean too much into 'design purity' than 'programmer convenience' and that parts of the stdlib are too 'object oriented'.
- Twey 2mo ago> in Clang/GCC the `__` is not explicitly reserved for builtins In fact in C identifiers starting with _ are reserved for the implementation (except for in local scope if the second character is not an underscore or capital letter).
- rjzzleep 2mo agoEarly Rust was a lot more readable as well. Somehow it turned into the perl 6 of systems languages. They crammed everything they could in there.
- jjgreen 2mo agoFavorite comment of the day; you do know it will get downvoted to crap right?
- panzi 2mo agoEarly Rust had ~ and @ references.
- a2ff6eeb0 2mo agoWhich, IMO, read nicer than words and ::s drowning out names.
- allthetime 2mo agoCustom syntax highlighting / theming to emphasize names vs. qualifiers is very helpful.
- panzi 2mo agoI'm not really against such special symbols, only if they are too much, like in Perl. ~ and @ weren't replaced by anything with ::, though, ~Foo is Box<Foo> and @Foo is Rc<Foo> (or is it Arc<Foo>?). :: to access a member of a module already existed when ~ and @ was in Rust.