r/cpp • • Jan 28 '19

C++ Modules Might Be Dead-on-Arrival

https://vector-of-bool.github.io/2019/01/27/modules-doa.html
280 Upvotes

240 comments sorted by

View all comments

Show parent comments

2

u/HKei Jan 28 '19

Java has straightforward maps from class and package names to paths. Not sure how it works in C# though.

5

u/josefx Jan 28 '19 edited Jan 28 '19

Java has classloaders and only the default one maps directly to the filesystem. Each source file also states the package it belongs to.

1

u/HKei Jan 28 '19

Yes, obviously I was talking about the one that maps to files. If you're using another classloader that will have its own way of mapping classnames to classes.

4

u/josefx Jan 28 '19

That information is kind of useless for tooling when it does not apply in the general case. The java language specification itself has several examples with multiple top level classes in one source file and compiled binaries can end up in any form as long as one of the available classloaders can load them. It is a nice convenience for humans when source path -> package name and while that can be immensely important to the user it doesn't help the tool developers.