Open Des-Nerger opened 1 month ago
related: #5893
have you noticed this confusion happen in the wild? not saying we shouldnt add this but my initial reaction was that its unlikely given that anytype is the only any thats not a discrete type/value
Debatable whether anyopaque
is discrete, seems more like anytype
than not to me, but that's a tangent here. I agree that it's relatively unlikely that someone would think that !T
could be replaced with anyerror!T
without changing the meaning/type of the expression.
I wouldn't describe an anytype
as type-inferred, I would describe it as type-generic. The anyerror documentation and that for inferred error sets seem pretty clear to me, is there something specific you feel is missing?
Since
anytype
in Zig means type inference, people may be misled into thinking thatanyerror
also does mean type inference; but just for error types. And so, they may get an idea that!T
is just an abbreviated and nicer way to write the "frequently used"anyerror!T
combination.I'm not suggesting changing the language itself here, but at least the reference should grab an attention to the distinction, give an example of where one of them could accomplish more than another, etc.