4 ms·
Am I the only one who thinks that Zig's syntax looks incredibly ugly? I've never seen a snippet that didn't make my eyes glaze over from the syntax. What am I n
by caslon 5y ago
Am I the only one who thinks that Zig's syntax looks incredibly ugly? I've never seen a snippet that didn't make my eyes glaze over from the syntax. What am I not getting here?
- deaddodo 5y agoAs someone who likes both C and Zig for their simplicity and explicitness, I don’t find it “ugly”. I do find it practical, with an aesthetically barebones approach.
- capableweb 5y ago> Am I the only one who thinks that Zig's syntax looks incredibly ugly? It's very subjective what is beautiful or ugly, of course. It'd be more interesting if you can offer specific critique rather than just calling it ugly. You're probably not the only one, I for one would call any non-lisp "ugly", but again, highly subjective, as many others find some C-like code beautiful but other C-like code ugly.
- jcelerier 5y ago> It's very subjective what is beautiful or ugly, of course. if it was, something like trypophobia would not exist
- capableweb 5y agoWhat? Are you arguing that because a phobia (that not everyone had) exists, beauty is not subjective but absolute? I'd love to see how you measure beauty if so, including the "beauty of code".
- Talanes 5y agoTrypophobia proves beauty subjective, not the other way around. I can find an image beautiful that someone with trypophobia finds deeply unsettling.
- jcelerier 5y agoObjective / subjective does not mean that things cannot be experienced relatively. Someone colourblind isn't able to distinguish all colours, yet it does not mean that colours as a frequency of electromagnetic radiation are subjective, only their experience is.
- pjmlp 5y agoYou are not alone, if I miss @ everywhere I will just start an Objective-C project. Then using modules with JavaScript AMD pattern is also not appealing.
- AnIdiotOnTheNet 5y agoIf using '@' to prefix builtins[0] is the biggest complaint[1] people have about Zig, then Zig must doing a pretty good job. [0] or really any statement at all about aesthetics [1] I know for a fact pjmlp will also complain about lack of built-in gc or ref-count pointer safety.
- pjmlp 5y agoPaying attention it seems.
- foxfluff 5y agoYeah, the syntax doesn't really excite to me too much. Which is a shame, because I would like to see a modernized "better C" that isn't more verbose than C.
- matheusmoreira 5y agoYeah. I think I'm so used to C by now that I just can't handle anything that doesn't look like C. It's like my brain just ignores text when it can't recognize the C code patterns. Semantically Zig is really interesting though.
- skocznymroczny 5y agoI feel similar when it comes to non-OOP code. I don't like free functions and global variables just hanging there.
- matheusmoreira 5y agoYeah, me neither. Names must belong to some namespace, it really bothers me when code starts binding common nouns in a global context. C lacks namespaces so I use prefixes instead. At least this solution doesn't screw up the ABI like in C++. I hate global variables so much it's one of the reasons I got rid of libc. Freestanding C turned out to be a superior language just because it lacks all the libc cruft. I ultimately dropped Ruby because of global state. It's such a wonderful language but it has one fatal flaw: lack of proper modules. The require method just executes Ruby source files, modifying the global state of the interpreter. It ceased to be a beautiful language once I realized this. Python's modules are superior, and the Javascript approach is the best one: just a normal function that returns a normal object containing exported data and functions. Javascript modules are c.ompletely reified.
- kristoff_it 5y agoOOP might have helped popularize usage of the dot notation, but namespaces are a different thing. Zig has no inheritance but everything is namespaced, including declaring functions inside struct definitions so that you can use them as if they were methods.
- cies 5y agoIt is common to make stuff you dont generally want in your code (but still need to be able to do because the language is sufficiently powerful) look ugly. Like unsafePerformIO in Haskell.
- kristoff_it 5y agoThis particular example is machine-generated code created by translate-c, it's meant to be semantically equivalent to the C code and even uses language features that you're normally not even supposed to use (c pointers). Reasonable Zig code looks more like this: https://github.com/riverwm/river/blob/master/riverctl/main.zig https://github.com/riverwm/river/blob/master/riverctl/main.z... That said I think it's fine if you don't like the syntax. I think that some complaints are honestly too superficial to be legitimate (like complaining about builtins being prefixed with @), but at the same time Zig is often times prioritizing explicitness over "good looking". I personally consider Swift a very good looking language, but then I look at all the new features that got added since I used it last, remember that I value simplicity over aesthetics, and go back to Zig.
- dragonelite 5y agoOoh that looks a bit like Rust having quickly scrolling by. I have been keeping a eye on Zig but I'm waiting till the package manager stuff has been finalized and implemented.