6 ms·
> Effectively, without support for build tools, modules are effectively dead in the water. ... > "We'll make the build systems understand". This seems to be
by wyldfire 9y ago
> Effectively, without support for build tools, modules are effectively dead in the water.
...
> "We'll make the build systems understand".
This seems to be a critical point that I agree with: you can't divorce these two, their fates must be bound to one another. Hopefully the build systems can be easily modified to accommodate.
Rust community folks might be wrong about c++ but they're right about Rust. Rust had the luxury of not being bound to any legacy specifications and it wasn't unreasonable for them to write their own build+dependency/package management tool. The net effect of them having done that means that independent of all the other great things Rust brings, much of the tedium of developing with C/C++ is gone.
Make no mistake, C++ standard committee: the bar is high and Rust has set the bar.
- pjmlp 9y ago> the bar is high and Rust has set the bar. Modules were introduced in the 70's as concept, Mesa being one of the first languages to use them, followed by CLU and ML.... The issue with lack of modules in C++, was that Bjarne had the compromise C++ should fit into C toolchains used by AT&T, and later all C shops. EDIT: I get Rust is quite cool, but maybe a bit of programming language research is also welcomed.
- humanrebar 9y agoI think "the bar" is talking about languages a developer might write her next application in. Mesa and CLU aren't on the list. OCaml might be, depending.
- pjmlp 9y agoExcept Rust modules (which are the subject here) are anything but innovative, there are plenty of languages since Mesa, CLU and ML came to the world with equally or better module systems.
- wyldfire 9y agoNote that I didn't mention innovation or novelty or originality. I just said that Rust "set the bar." To respond to your objection I'd just clarify by qualifying it better and refer to the "systems programming" or whatever domain C/C++ and Rust both belong to.
- pjmlp 9y agoSo then check modules in Modula-2, Modula-2+, Modula-3, Ada, Oberon, Oberon-2, Oberon-07, Active Oberon, Component Pascal, Turbo Pascal. All used in the context of systems programming. Rust modules don't add anything new to them.
- jononor 9y agoRust has not brought much new in terms of modules. It just has decent modules support according to established best-practice. The innovations are primarily around the borrow-checker.
- pjmlp 9y agoThat I agree with.
- AaronFriel 9y agoIt adds an excellent packaging system and developer experience in the form of cargo, which is also a package manager for external modules. "The bar", I think, is taken to mean the combination of all of these features and their execution, not the idea of modules.
- pjmlp 9y agoA packaging system is orthogonal to modules. Those ideas are also present in Maven, Gradle, NuGet. All older than cargo. And all trace back to CPAN as general concept. I am still waiting for cargo to support binary libraries.
- 9y ago
- earenndil 9y agoThere are plenty of widely-used languages that have modules and came well before rust.
- qznc 9y agoThe word "module" has very different meanings. When I read about 1ml [0] I stumbled upon this: > A definition like this, where the choice of an implementation is dependent on dynamics, is entirely natural in object-oriented languages. Yet, it is not expressible with ordinary ML modules. Here, ML modules are compared to classes (not packages or modules has defined in Java, for example). This makes me wonder how often people talk past each other without noticing, when they discuss modules. [0] https://people.mpi-sws.org/~rossberg/1ml/1ml.pdf https://people.mpi-sws.org/~rossberg/1ml/1ml.pdf
- pjmlp 9y agoTrue, but there is an actual definition. https://en.wikipedia.org/wiki/Modular_programming https://en.wikipedia.org/wiki/Modular_programming There are plenty CS books which offer a similar definition to Wikipedia.
- qznc 9y agoFor Java, class, package and (Java 9 Jigsaw) module all fit the Wikipedia definition of module. We might have consensus about the definition, but it does not seem to be a useful precise one. The C++ working group seems to have a similar problem. Things like "compilation unit" have a precise meaning, but they cannot find consensus if it should relate to their "module" or not.
- pjmlp 9y agoThe basic concept of module is having language support for code separation, with data/code hiding, compiler type checking across modules and optimally a binary format. I think the issue is more with some C++ devs that never used other languages, trying to grasp how modules fit into translation unit + PCH model they know.
- pornel 9y agoYou seem to be responding to a claim that Rust invented modules, but I think nobody said that. Nothing in Rust is original from PL theory perspective. It's deliberately not a research language, but a practical one. Rust set the bar here merely by showing up and delivering a decent implementation (in a language that you can actually use today).
- pjmlp 9y agoRust sets the bar with the borrow checker and safer concurrency. Everything in terms of safety and modules was present in languages like Ada and Modula-3.
- unclewaltr 9y agoWeren't modules created by Herb Sutter at Microsoft to improve the VS201x IDe and compiler? If this is the case, it seems a big player in the tooling world is already on board.
- pjmlp 9y agoNo, Apple designed them for Objective-C initially, so some support was added to clang for all C languages, based on module maps. Google improved that implementation for C++ and has a private implementation of it in use. Gabriel dos Reis picked up some ideas from a former work he did together with Bjarne for MSVC++. The ongoing C++ Modules TS is to merge the ideas from both sides into what will become C++ Modules.
- unclewaltr 9y agoHmm, I suppose I was talking about the specific work to integrate modules in to the C++ standard. I recall hearing from Bjarne at a STAC talk he gave a year (or so) ago that he and Herb had been coordinating effort between MS and MSFT to use Modules in the Microsoft toolset to improve compiler performance. The history of modules you provided is helpful though, thanks.
- IshKebab 9y ago> the bar is high and Rust has set the bar I don't think Rust deserves much praise for its module system. It is widely regarded as being extremely confusing even for pros. There are efforts underway to make it saner: https://withoutboats.github.io/blog/rust/2017/01/04/the-rust-module-system-is-too-confusing.html https://withoutboats.github.io/blog/rust/2017/01/04/the-rust... https://github.com/rust-lang/rfcs/pull/2126 https://github.com/rust-lang/rfcs/pull/2126
- fasquoika 9y ago> It is widely regarded as being extremely confusing even for pros. No, it's mostly considered to be unintuitive, not confusing for people who know it. You're unlikely to "just get" how it works, but once you learn it it's perfectly reasonable. Edit: Note that the RFCs don't actually change how the module system works, just the syntax
- gpderetta 9y agoI would like modules to fix the issues with the header inclusion model and hundreds of thousand lines long translation units. Anything else is mission creep at this point and risk delaying the effort further. Let's fix a problem at a time.
- Shorel 9y agoC++ has taken new features like auto and static if from D, not from Rust. I would say for the C++ standard committee the bar is high and D has already set the bar.