logoalt Hacker News

yunnppyesterday at 8:21 PM5 repliesview on HN

I recently started a pet project using modules in MSVC, the compiler that at present has best support for modules, and ran into a compiler bug where it didn't know how to compile and asked me to "change the code around this line".

So no, modules aren't even here, let alone to stay.

Never mind using modules in an actual project when I could repro a bug so easily. The people preaching modules must not be using them seriously, or otherwise I simply do not understand what weed they are smoking. I would very much appreciate to stand corrected, however.


Replies

senfiajyesterday at 9:23 PM

I still hope that modules become mature and safe for production code. Initially I coded in C/C++ and this header #include/#ifndef approach seemed OK at that time. But after using other programming languages, this approach started to feel too boilerplate and archaic. No sane programming language should require a duplication in order to export something (for example, the full function and its prototype), you should write something once and easily export.

show 2 replies
bluGillyesterday at 9:55 PM

Modules are still in the early adoptor phase - despite 3 years. there are unfortunately bugs, and we still need people to write the "best practices for C++ modules" books. Everyone who has use them overall says they are good things and worth learning, but there is a lot about using them well that we haven't figured out.

show 1 reply
malfmalfyesterday at 9:37 PM

They are using modules in the MS Office team:

https://devblogs.microsoft.com/cppblog/integrating-c-header-...

show 1 reply
vitautyesterday at 10:24 PM

Modules have been working reasonably well in clang for a while now but MSVC support is indeed buggy.

throw_sepplesyesterday at 11:29 PM

I'm afraid things will continue very much sucking for a long time and will still be less-than even when they become broadly supported since sepples programmers, being real programmers™, are not entitled to have nice things.