3 ms·
I fear that it will fail because it rejects information hiding. There isn't all that much new C being written, so it seems counterproductive to renounce the use
by kps 4y ago
I fear that it will fail because it rejects information hiding. There isn't all that much new C being written, so it seems counterproductive to renounce the users that (have to) follow coding standards like MISRA C and CERT C.
- Animats 4y ago> information hiding An interesting point, especially at API boundaries. C and Zig not having information hiding is to some extent a feature. C++ is notorious for having information hiding without safety. Almost no other language has that combination.
- kps 4y agoI certainly understand the Zig core's arguments, but I don't think they'll matter in the places where these C coding standards are used. I'm sure an external linter could solve the problem using some naming convention or magic comments, but I'm not sure it'll get far enough for that to be written. [Edit: there does seem to be community interest in metadata annotations for external static analysis https://github.com/ziglang/zig/issues/14656 https://github.com/ziglang/zig/issues/14656 ] Although I only have a beginner knowledge of the language, it seems to me that Zig is just on the edge of being able to provide a nice unification of the C opaque-pointer idiom with other opaque handles (e.g. POSIX file descriptors, GL handles).
- pron 4y agoI can't say that I feel naturally attracted to Zig's position on information hiding (although I do find the whole package a good fit for most of my personal preferences), but it's hard for me to predict how the gestalt of its features will perform in the market, not to mention that the market success of any product is affected by many factors that aren't intrinsic to the product. BTW, how did you reach the conclusion there isn't "all that much new C being written"?
- kps 4y ago‘Much’ is a relative term; there may be more absolute lines being written today than at its relative peak. But I see the spaces where a green-field project would choose C shrinking; even lightbulbs run C++ now that economies of scale have made 32-bit controllers so cheap. (I've written a lot of C, including parts of a C compiler, so I know it well, and I'm just not seeing it get much attention now. But if I could write Zig in a job I do think that would be more fun than writing C in a job again.)