M
Modular9mo ago
gryznar

2 modules to handle paths

Why do we need both pathlib and os.path? I am aware that Python has that, but why not to simplify things and have just one module named path with object orientend path handling?
7 Replies
Ryulord
Ryulord9mo ago
Mojo is intended to eventually be a full python superset. My understanding is that this means it will eventually have a full replica of Python's standard lib so if python does it then Mojo needs to do it too. The idea is that this should help Mojo gain traction where other languages like Julia haven't but that does mean inheriting some of Python's mistakes.
gryznar
gryznarOP9mo ago
But it does not make sense in terms of maintanance, consistency and thin stdlib
Ryulord
Ryulord9mo ago
and all of those things need to potentially be sacrificed to some extent when you decide to build a strict superset language
sora
sora9mo ago
Again, that's something that can be solved by building compatibility shim libs to help with transition and adoption. They are just libraries and don't have to be part of "the language". Maybe not the case for pathlib or os.path which I know nothing about, I do find it difficult to argue that the all stdlib is part of Python the language. This can be seen from the recent removal of quite some Python stdlib modules.
gryznar
gryznarOP9mo ago
The best will be to implement Python stdlib as external library not required in Mojo
Ryulord
Ryulord9mo ago
I think the important thing there is that it's a single library. You don't want people considering migration to have to hunt down 40 dependencies that used to just be in the stdlib
Melody Daniel
Melody Daniel9mo ago
I just looked at the library reference for both, they provide different interfaces. Will it still be considered a superset this year? I have one experience with supersets and that's with Typescript, it has everything from Javascript (library and syntax) and then more.
Want results from more Discord servers?
Add your server