13 ms·
> I think C would be 10x more useful language if it ditched include files and had "import" like python I'm trying to imagine this, and I'm at a loss. How do
by akira2501 6y ago
> I think C would be 10x more useful language if it ditched include files and had "import" like python
I'm trying to imagine this, and I'm at a loss. How do you mean? The namespaced part of the import, where you can pick and choose what you get? Or the managed part of the import, where all your libraries live in a language-version-specific folder?
One of the great joys, to me of C, is it's insane flexibility. Include files are a hassle, but I don't feel they're something I've ever had to work around. I can't say the same for /usr/lib/pythonX.Y or in particular the way things like 'pip --user' work.
> I'm pretty sure a lot of the popularity of oop actually came from modularity
That's one area where C could be better, in my opinion. I don't need inheritance or friend classes or any of that, what I _really_ want is to namespace the methods that are meant to work on a single struct _with_ that struct itself.
Effectively, I would love to write my C structs the way C++ coders write the POD types.
- m463 6y ago> The namespaced part of the import. To me this is the primary benefit (although the file mapping is convenient). As to python... it is impossibly more flexible than C. I have done silly stuff like reading all the files in a directory, then i imported all the python files I found. I think C is not very deep, but it is very well known.
- dj_mc_merlin 6y agoThat's an apples to oranges comparison. Python is interpreted, and can guess what the programmer wants much better than a compiler that has to output actual machine code. > I think C is not very deep Depends on what you're using it for, I suppose. For low level stuff I enjoy the fact that I can largely tell the shape of assembler from C code. What does Python really execute when I do `f = open('file', 'rb')`?