4 ms·
True, I'm working with Swift which doesn't have that concept. But you can't have collisions between similarly named functions that are in the main or a differen
by dep_b 6y ago
True, I'm working with Swift which doesn't have that concept. But you can't have collisions between similarly named functions that are in the main or a different namespace? For example when somebody defines it's own version of 'print'?
- ketzu 6y agoYou can have name collisions of functions with the same name, same namespace and same signature. But you can have nested namespaces, so namespaces are still the answer in c++. In languages where those are not available or where you are forced to use classes anyways (e.g., java) I see no problem with classes-as-a-namespace, but especially in java there is no point in discussing "classes that should be free functions", too, as those don't exist.