5 ms·
Sometimes I wonder which languages people use for system tools. I mean, it is hard enough that C programs (with dynamic linking) break sometimes, but building a
by JepZ 8y ago
Sometimes I wonder which languages people use for system tools. I mean, it is hard enough that C programs (with dynamic linking) break sometimes, but building a shell on top of Python seems like a particualar bad choice to me (similar to building a package manager with python).
In my opinion, such few-dependency, high-importance tools should linked statically.
- munchbunny 8y agoI think that anyone who is trying to imagine "the next shell" owes it to themselves to try PowerShell. It's .NET based and very, very different from the sh lineage, but I absolutely love its ability to use objects instead of strings as the underlying transmission medium between "processes". E.g. ls gives you file descriptors, ps gives you process descriptors, etc.
- JepZ 8y agoI was just about to ask if it is available for Linux, but then I saw that the official page advertises its cross-platform properties [1] :D I know about the different concept of Powershell for quite a while now, but since it is MS tech I didn't expect it to be available for Linux. Maybe I will try someday how it feels, but I am sceptical as the thing I like most about POSIX shells is that everything is just text and I wonder how Powershell will integrate with other *nix tools. [1]: https://github.com/powershell/powershell https://github.com/powershell/powershell
- munchbunny 8y agoThe boundary layer between text and object is definitely a weak spot in the abstraction for PowerShell. That's the main reason why I don't consider PowerShell strictly superior. That said, the way the language is designed makes calling into compiled .NET code seamless, which in turn makes doing really sophisticated shell scripting a breeze. When I saw what xonsh was trying to do, I recognized a lot of "PowerShell solves this problem a bit more gracefully".
- xrd 8y agoI've heard of it but never heard a compelling reason to try it. Until your statement: I'm now very interested.
- insertnickname 8y agoGentoo's portage package manager is written in Python. https://github.com/gentoo/portage/ https://github.com/gentoo/portage/
- JepZ 8y agoAnd that is probably one of the reasons why projects like Paludis were started years ago. The funny thing about Portage is though that Python doesn't cause any performance issues as Portage/Emerge is slow by design. So while Paludis is written in C++, it isn't much faster, as it still has to interpret all those thousands of bash-style ebuilds/exheres. This might sound as if I wouldn't like Gentoo/Exherbo et al. but in fact, my desktop PC is running Gentoo or Exherbo for the last 10 years at least. But it was exactly that experience which made me conclude that system tools like package managers, shells, etc. should be written in statically linked languages.
- marmaduke 8y ago> building a shell on top of Python seems like a particualar bad choice to me can you say why? Python's stdlib handles a lot of cross-platforminess, Python is mostly easy to write, and is available as or more easily than a C compiler on many platforms.
- JepZ 8y agoIt's about stability. It is much easier to break a dynamically linked or interpreted script than a statically linked binary. The worst case of fixing a system with a software failure is booting a live-cd and replace the files which cause trouble, but a broken shell and sometimes also a broken package manager are precisely those cases when you have to boot a live-cd.
- marmaduke 8y ago> It is much easier to break a dynamically linked or interpreted script than a statically linked binary If we’re talking about new code, why is this the case?