ratfactor/ziglings

Further explanation or link in 026_hello2.zig

Closed this issue ยท 2 comments

There's this comment on main, regarding the use of !void: "(...) but can have consequences elsewhere."

It would be better to either point to an explanation or mention it will be explained in a later exercise (earlier exercises did this).

I personally don't know what the consequences are, but I'm happy to contribute with changes if someone half explains to me ๐Ÿ‘

Thanks! You're right. That sentence is not very helpful.

I don't know what I had in mind when I originally wrote that, but thankfully the Zig documentation now has a good explanation:

When a function has an inferred error set, that function becomes generic and thus it becomes trickier to do certain things with it, such as obtain a function pointer, or have an error set that is consistent across different build targets. Additionally, inferred error sets are incompatible with recursion.

https://ziglang.org/documentation/master/#Inferred-Error-Sets

Let's see if I can shorten that down:

"This is appropriate in the case of main(), but can make a function harder (function pointers) or even impossible to work with (recursion) in some situations."

Can you think of any improvements?

I like your suggestion ๐Ÿ‘ add the link as reference too (unless the zig docs change often)