Sujet : Re: Why Python When There Is Perl?
De : OFeem1987 (at) *nospam* teleworm.us (Chris Ahlstrom)
Groupes : comp.os.linux.advocacyDate : 10. Apr 2024, 14:36:35
Autres entêtes
Organisation : None
Message-ID : <uv614l$v3vk$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : slrn/1.0.3 (Linux)
Lawrence D'Oliveiro wrote this copyrighted missive and expects royalties:
On Tue, 9 Apr 2024 08:46:03 -0400, Chris Ahlstrom wrote:
>
Lawrence D'Oliveiro wrote this copyrighted missive and expects
royalties:
On Sat, 6 Apr 2024 07:59:04 -0400, Chris Ahlstrom wrote:
>
Lawrence D'Oliveiro wrote this copyrighted missive and expects
royalties:
Until you realized it would never work, because classes are not
objects in C++.
:-D WTF you talkin', Willis? Ye nae true Scotman fallacy?
>
You tell me: does C++ accept “true Scotsmen” among its users/features,
or not?
C++ provides many forms of programming, including object-oriented
programming.
>
But no metaclasses, like Python does.
>
I came up with an interesting use for them, to allow convenient definition
of a hierarchy of exception classes representing return codes from a given
API. More details in the “Uses For Metaclasses” notebook in this
collection <https://gitlab.com/ldo/python_topics_notebooks/>.
Interesting. It is not clear to me why you need metaclasses to implement the
example, though.
On another note, C++20 introduces the concept of "concepts", which put
constraints on templates and their parameters. The constraints are based on
concepts like you'd find at cppreference.com:
std::map meets the requirements of Container, AllocatorAwareContainer,
AssociativeContainer and ReversibleContainer.
The full list is here:
https://en.cppreference.com/w/cpp/conceptsWell, not the full list:
Additional concepts can be found in the iterators library, the algorithms
library, and the ranges library.
These programming languages arms races are fun!
-- Time to be aggressive. Go after a tattooed Virgo.