2 ms·
Actually, that's already how it works. :) Imports are relative to the importing file unless they start with a '/', in which case the import path is searched.
by kentonv 13y ago
Actually, that's already how it works. :) Imports are relative to the importing file unless they start with a '/', in which case the import path is searched.
The protobuf approach was somewhat necessitated by the fact that various parts of the protobuf implementation expected file names to be canonical, e.g. so that it could tell if two descriptors were for the same file by comparing the names. This mean it was necessary for the compiler to know where the top of the source tree was and dealing with relative paths would have been pretty ugly. This worked fine for Google-internal usage, but was problematic for a lot of open source users.
Cap'n Proto does not use file names as canonical identifiers. Instead, it requires every file to assign itself a unique ID (a random 64-bit number). This introduces some other problems, but on the whole I think it comes out a lot nicer.
- DannoHung 13y agoWoo! Awesome!