3 ms·
> Holding things by pointer on the other hand actually does let you prevent the includes since you can just forward declare in the header, but it's an indirecti
by DavidVoid 4y ago
> Holding things by pointer on the other hand actually does let you prevent the includes since you can just forward declare in the header, but it's an indirection :-/
And it means you now need to deal with raw pointers, which often isn't optimal or preferred (over say references for example).
At least we'll get modules soon. That should reduce the need for some of these workarounds that are really mainly used to reduce compile times, and not to improve the code in any other meaningful way.
- lfowles 4y agoSure, but you can also forward declare references!
- DavidVoid 4y agoFor some reason I thought they weren't but that's good to know.
- jll29 4y agoThere are issues with type safety when using raw pointers (e.g. void ) over alternatives. Reminds me of the good ol' days when Modula-2 had .def (definition) and *.mod2 (implementation) files, and you could compile the definition files alone to get binaries of the interface files that you could write and compile against in a typesafe way before the interfaces were even implemented And as far as I recall the decoupling also made things compile fast (e.g. with Applications Systems Heidelberg's Modula-2 on the Atari ST 520+).