2 ms·
It’s not though. In lots of languages a namespace can span multiple files, whereas a class must be declared in a single file[0][1]. Modules can usually contain
by _gabe_ 3y ago
It’s not though. In lots of languages a namespace can span multiple files, whereas a class must be declared in a single file[0][1]. Modules can usually contain a collection of functions and classes. And namespaces can also contain multiple classes/structure/functions and sometimes modules depending on the language[2].
[0]: https://www.typescriptlang.org/docs/handbook/namespaces-and-modules.html https://www.typescriptlang.org/docs/handbook/namespaces-and-...
[1]: https://learn.microsoft.com/en-us/cpp/cpp/namespaces-cpp?view=msvc-170 https://learn.microsoft.com/en-us/cpp/cpp/namespaces-cpp?vie...
[2]: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/namespaces https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...