Re: Why Python When There Is Perl?

Liste des GroupesRevenir à ol advocacy 
Sujet : Re: Why Python When There Is Perl?
De : OFeem1987 (at) *nospam* teleworm.us (Chris Ahlstrom)
Groupes : comp.os.linux.advocacy
Date : 03. Apr 2024, 14:28:07
Autres entêtes
Organisation : None
Message-ID : <uuji0p$3ts8k$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
User-Agent : slrn/1.0.3 (Linux)
Lawrence D'Oliveiro wrote this copyrighted missive and expects royalties:

On Tue, 2 Apr 2024 08:51:57 -0400, Chris Ahlstrom wrote:
>
Lawrence D'Oliveiro wrote this copyrighted missive and expects
royalties:
 
On Sun, 24 Mar 2024 09:39:21 -0400, Chris Ahlstrom wrote:
>
C++ can do template metaprogramming.
>
Python doesn’t need two different languages for “compile-time” versus
“run-time” programming; it uses the same language for both.
 
I think that Alexander Stepanov would say..... [some incomprehensible
C++ technical term]
>
Also, consider enums. I think C++ only has the old, boring, C-style enums.

Nah, it also has "enum class" etc.

    https://en.cppreference.com/w/cpp/language/enum

Java managed to introduce quite an advanced enum facility, with the
ability to attach custom methods and attributes to enum instances.

The C++ enum-class is scoped and strongly typed, thus a bit restrictive.
Implicit conversion (e.g. to int or char) is not supported. In some cases, it
is useful to write free functions or operators to do things with them.  It gets
tiresome peppering code with static_cast<>.

Python offers the same sort of thing as Java. Only, whereas Java enums are
a feature that is built into the core language, Python does it as a
standard library module, written in pure Python.
>
How do we do it? Metaclasses! (Also descriptors help.)
>
Function definitions and class definitions are not declarations: they
are just forms of assignment statement.
>
And then there are metaclasses ...
 
I wonder if the C++ metaclass proposal ever made it into C++. Will have
to check....
>
I’ll be waiting.

Sounds like not. Apparently not considered worth the effort in the end.
After all, we already have abstract base classes and templates.

--
In the plot, people came to the land; the land loved them; they worked and
struggled and had lots of children.  There was a Frenchman who talked funny
and a greenhorn from England who was a fancy-pants but when it came to the
crunch he was all courage.  Those novels would make you retch.
-- Canadian novelist Robertson Davies, on the generic Canadian
   novel.

Date Sujet#  Auteur
2 Oct 24 o 

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal