8 ms·
I often wonder how this would map to other languages (as C++ often entails complexity and clever work arounds such as this article). In Java or C# (and of cour
by mindfulplay 7y ago
I often wonder how this would map to other languages (as C++ often entails complexity and clever work arounds such as this article).
In Java or C# (and of course in C++), you could have a token system where the token can only be provided by Device :
VFS:
void register(DeviceToken):
DeviceToken: empty interface (marker)
Device:
private DeviceToken provideDeviceToken();
This hides both VFS and Device classes from accessing each others' private members.
You can also constrain how gets to provide DeviceToken by adding sufficient comments in code.