←back to thread

228 points Retro_Dev | 8 comments | | HN request time: 1.121s | source | bottom
Show context
barelysapient ◴[] No.44465168[source]
A big change like this makes me hopeful Zig may revisit and improve other design choices in the future.
replies(1): >>44466074 #
1. bbkane ◴[] No.44466074[source]
Could you elaborate on the choices you'd like revisited?
replies(3): >>44466265 #>>44470288 #>>44472856 #
2. 90s_dev ◴[] No.44466265[source]
Unused variables stops all further compilation, so that even future errors can't be seen until the variable is used.
replies(2): >>44467902 #>>44468527 #
3. Mond_ ◴[] No.44467902[source]
Meh.

I think this should be a warning on debug builds and an error on release builds, but it's a relatively minor thing and not a deal breaker by any means.

If this is the worst thing that people would like to see revisited, Zig must be doing amazingly well.

replies(1): >>44469251 #
4. mlugg ◴[] No.44468527[source]
This is simply not true. See https://zigbin.io/f57b94/run.

(That link seems to show the "unused local variable" error line twice for me; that's some kind of bug with this zigbin service and does not reproduce when running the Zig compiler normally.)

5. josephg ◴[] No.44469251{3}[source]
> but it's a relatively minor thing and not a deal breaker by any means.

It totally breaks my normal workflow. I don’t use zig at all because of this misfeature. Warn in debug and error on release builds would be strange but fine.

replies(1): >>44471738 #
6. thayne ◴[] No.44470288[source]
Not the original poster, and I don't have very high hopes that these will be revisited, but some things I would like to see revisited are:

- ability to define anonymous functions without having to put it inside an anonymous struct. I get the argument against closures (even if I don't fully agree with it), but not having first class support for anonymous functions feels pretty regressive for a modern language

- have a way to include payload data with errors. Or at the very least, define an idiomatic pattern for handling cases where you have additional data for an error

- allow struct fields to be private

- bring back async support in some form (this one I do have some hope for)

7. ◴[] No.44471738{4}[source]
8. xmorse ◴[] No.44472856[source]
I would like to have some kind of interfaces instead of having to always use anytype, so compiler errors will appear in the call site instead of the called function body