4 ms·
The question is, what classes do that module systems don't? Modules (at least in Python) are singletons.
by CodeMage 14y ago
The question is, what classes do that module systems don't?
Modules (at least in Python) are singletons.
- loup-vaillant 14y agoDoesn't count. When you define a single data structure in a module, (along with functions to manipulate it) you can instantiate it just like you would a class.
- CodeMage 14y agoUgh. That's like saying that high-level programming languages "don't count" because you can do that stuff in assembler.
- loup-vaillant 14y agoI'm not arguing Turing completeness here. I'm arguing trivial one to one mapping. Syntax sugar. Compare: struct foo { int bar; float baz; }; int get_bar(foo); float get_baz(foo); Which would emulate this: class foo { public: int get_bar(); float get_baz(); private: int bar; float baz; }; If you're interested, I wrote more about that here: http://loup-vaillant.fr/articles/classes-as-syntactic-sugar http://loup-vaillant.fr/articles/classes-as-syntactic-sugar