Sujet : Re: Python recompile
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 06. Mar 2025, 03:28:29
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vqb18d$2mem7$2@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
User-Agent : Pan/0.162 (Pokrosvk)
On Wed, 5 Mar 2025 11:46:08 +0000, bart wrote:
* Compile-time enumerations, and parallel tables of enums and data
Python doesn’t have enumerations as a language primitive; instead, they
are implemented in a library module, written in pure Python -- it doesn’t
do anything you can’t do in your own code. But it supports arbitrary
attributes attached to enum instances, and subclassing of enums.
* Jump-table-based 'switch' (this requires those named consts or enums)
Does it do switched expressions? You can do those in Python.
* Built-in Support for C-style data types, including C-style structs and
homogeneous array types
* Built-in FFI for C-style APIs
Python provides this in the standard-library ctypes module. Remarkably
useful for making a wrapper around a C library to make it look like the
library was designed for use from Python. I have done a lot of wrappers
like this.
* Character constants: 'A' and 'ABCDEFGH' (Python needs 'ord("A")')
Python also has “\u” and “\U” for Unicode.
* Static local variables within functions
Not really necessary, with classes.
Do you have lexical binding?
* Built-in maths functions and constants like 'pi'
Complex arithmetic? <
https://docs.python.org/3/library/cmath.html>
Hyperbolic functions? Gamma/log-gamma?
<
https://docs.python.org/3/library/math.html>
There’s a reason why we don’t want to build all these into the core
language, since there are so many of them that are needed nowadays.
* Expression-based macros
Really only necessary if your language is not dynamic enough.
I notice no mention of coroutines or iterators. Those are quite useful
nowadays.