←back to thread

200 points jorangreef | 3 comments | | HN request time: 0.618s | source
Show context
HourglassFR ◴[] No.24294015[source]
I've stumbled upon the Zig language a while back and have been checking in regularly to follow its progress. Recently I took the time to write a very small program to get a feeling for it. My thoughts :

- It's a very low level language. Having written mostly Python for the past few years, it is quite the contrast. I had to force myself to think in C to get the train going

- Getting my head around the error handling took more time than I'm willing to admit. In the end, it's like having exception but being more explicit about it. It feels nice when you get the hang of it

- The documentation of the standard library is severly lacking, to be fair the language is still very young. More worrysome, it feels very cluncky.

- No proper string support. It is sad that a modern language still goes down that route after Python has shown that correcting this is both definitely worthwhile and a word of pain.

- I have the feeling that optional and error union types are a bit redundant, but I have not written enough Zig to have a real intuition on that. Maybe it is just that I understand monads now.

replies(5): >>24294053 #>>24294562 #>>24295081 #>>24298209 #>>24300406 #
1. gautamcgoel ◴[] No.24300406[source]
Can you elaborate a bit more about what your found lacking in Zig strings?
replies(1): >>24304522 #
2. HourglassFR ◴[] No.24304522[source]
Well there are no strings, only byte arrays. Now that's fine if you only pass bytes around in a stream, but if wan't to do any computation it you have to assume an encoding and basically anything outside of straight ASCII will be a pain.

Now you may argue that this can be handled nicely in the standard library without changing the language. This is correct, but there will be some frictions with string litterals.

replies(1): >>24329746 #
3. LakeByTheWoods ◴[] No.24329746[source]
What frictions do you anticipate? String literals in zig are utf8 encoded.