Sujet : Re: Multiple Inheritance [was Re: The joy of FORTRAN]
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : alt.folklore.computers comp.os.linux.miscDate : 03. Oct 2024, 22:52:34
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vdn3n1$3ssv4$4@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
User-Agent : Pan/0.160 (Toresk; )
On Thu, 3 Oct 2024 08:58:35 +0100, Pancho wrote:
Deep down, I don't really care about enums. They are nice to have,
intellisense mainly, but I don't want to spend time thinking about them.
Ah, I wondered. So you depend on your IDE’s autocomplete to do at least
some of your thinking for you? That might explain your attitude to coding.
Enums have a great many uses. You know about bit masks? I use enums here
<
https://gitlab.com/ldo/inotipy> to give them symbolic names (easier for
the user to understand) that can be used in a set that encodes to the mask
(because that’s what the underlying C API expects), and conversely the
enum provides a classmethod that can decode the low-level mask back to a
set of symbolic names, for easier display for debugging.
It’s all about using the language tools available to make things easier
for yourself.
“Interfaces” are just “abstract base classes lite”. They are a way to
provide a very limited form of multiple inheritance, in the hope that
this would somehow avoid the bewilderment that comes from multiple
inheritance as done in C++.
"Pure virtual classes" rather than abstract.
Only C++ uses the term “virtual” in that sense. Proper OO languages don’t.
There is a trade off between a software language being simple, and being
able to neatly solve all problems.
Some languages manage to be simpler, and yet more powerful, than others.
Compare Python to Java or C++, for example.