Talk:Z21
Documentation
No way to differentiate between different unit type
Unit type does not have identity or something like that that would allow to differentiate different kind of Unit object between them. Z30601 show that any unit is considered a void.
Or maybe that’s just the function that is mis-named and should be named "void type"?
(I’m used to Rust. Here, there are not really void, as it prefer to uses an enum with two value, one without the value, and one with the value, and the enum need to be deconstructed in some way, guaranteing you can’t access that absent value if it isn’t present)
(It does have unit type, thought. But they are type, not value. Of course, you can then instantiate a unit type. They are called zero-sized, due to fact they don’t need to allocate memory. And they are mostly usefull for certain specific complicated stuff with types and generics. Such as using typed Map to a typed Set, which is just a Map with a Zero-sized value, which can be turned into no-op)
(that is different than empty types, which can’t be allocated, and so can never exist. Usefull if you are forced to provide an error by the API, but your code is unfaillible. Not that it matter much when an empty type can implement pretty much all interfaces that doesn’t implement a function that create this type, and so the "!" type is used most of the time in those case.)
(that said. Rust is strongly typed. Unlike wikifunctions. As evidenced by the presence of reify and abstract that allow to create arbritrary invalid structure) Marius851000 (talk) 08:30, 15 December 2025 (UTC)
- Wikifunctions supports only a single object whose Type (Z4) is set to Z21. This follows from the fact that no keys are defined for that Type beyond the mandatory Z1K1 that identifies the object’s Type. There is therefore no notion of a “different kind of Unit object”, and no meaningful differentiation is possible.
- It is not quite accurate to say that “any unit is considered a void”; rather, any valid representation of the Unit instance is necessarily void by definition, and all such representations are equivalent. In both theory and practice, “is void” and “object’s Type is Unit” are the same function, and this should be reflected in its aliases [to-do]. GrounderUK (talk) 11:51, 15 December 2025 (UTC)