News for hackers. Stuff that matters.
Re:Trying out C++20's modules with Clang and Make by lelanthran on Monday October 16, 2023 @02:08AM (#37896371)
> Modules on the other hand are more strict and would likely have made the job of writing language bindings easier and more predictable.

There's two ways for tooling like swig to work with modules:

1. Read the compiled module and generate the stubs to call into it.

2. Read the source code for the module and generate the stubs for it.

Which of those, do you think, is easier than reading C (not C++) header files?

Re:Trying out C++20's modules with Clang and Make by dagmx on Monday October 16, 2023 @10:45AM (#37900550)
Reading the module information would be significantly easier. (which is not something swig can do today since swig hasn’t been updated in a while )

Parsing code to define an API is horribly fragile. A single macro or unknown keyword can break it. Hence why you had to specify C not C++ headers.

Having a statically defined metadata like C++ modules do would have greatly simplified binding generation