News for hackers. Stuff that matters.
Re:JavaScript Modularity Shaming by amelius on Wednesday January 07, 2015 @04:09PM (#8853321)
Could you elaborate on the C++ part?
Re:JavaScript Modularity Shaming by DiThi on Wednesday January 07, 2015 @05:14PM (#8853679)
C++ doesn't have a "load this module" statement. I does have an "include all the contents of X file here", and file X has to deal with possible duplication and cyclic dependencies, usually with something like

#ifndef _SOME_FILE_H #define _SOME_FILE_H // code goes here #endif

Also any "module" can define any global variable, so name clashes (esp. with C libraries) are possible. Most languages with proper modules the "global" variables are module-wide.

An equally nasty issue happens with JS, where many libraries must be loaded in the proper order and not duplicated. There are a bunch of module systems but none is part of the spec. The good thing is that module systems are easy to make thanks to closures.

Re:JavaScript Modularity Shaming by lomnakkus on Wednesday January 07, 2015 @04:33PM (#8853455)
The short answer is that "it's complicated". The most accessible long answer I'm aware of for non-C++'ers is at [1] (video). If you prefer text, the standardese version is at [2]. Unfortunately I cannot find a concise text version for laymen except perhaps [3].

[1]: https://www.youtube.com/watch?v=4Xo9iH5VLQ0

[2]: http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2014/n404...

[3]: http://clang.llvm.org/docs/Modules.html