Hacker News new | ask | show | jobs
by visualradio 1857 days ago
The issue with most Better C languages is that they focus on ABI rather than API compatibility and throw away C header parsing because no one likes libc.

With cross-platform standards like OpenGL, POSIX, Vulkan the API is declared in terms of high-level ANSI C or C99 language constructs and binary constants may be unspecified and left up to vendor.

Ideally new language designers which don't want to support H files would propose an even simpler header file format for listing procedures, enumerations, structs, constants that existing C compilers could also support. Library vendors don't have time to generate header bindings for every new language using language specific constructs, and application developers don't have time to manually write bindings for large libraries when testing new languages.

Zig supports C header parsing, but as you mention is based on LLVM. It also allows defining new functions inside structs and return values, which can result in heavily nested code that some programmers may not be a fan of.

So there is theoretically some room for another language which maintains compatibility with C headers (or defines an even simpler header format which can be supported by C compilers), which does not use LLVM, and which maintains stronger conceptual separation between namespaces and structs.

1 comments

LLVM is about to become an optional component of Zig once the self-hosted compiler is done.

https://kristoff.it/blog/zig-new-relationship-llvm/