Sujet : Re: When Is A High/Low-Level Language Not A High/Low-Level Language?
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 17. Aug 2024, 23:11:33
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v9r76l$2289h$5@dont-email.me>
References : 1 2
User-Agent : Pan/0.159 (Vovchansk; )
On Sat, 17 Aug 2024 11:19:30 +0100, Bart wrote:
... what does this have to do with C, or anything at all?
C is supposed to be the epitome of the low-level language that can do bit-
fiddling and unsafe type conversions and the like. This is an example of
an unsafe type conversion (offering a typesafe interface to the caller, of
course) done dynamically, in a language which is generally considered to
be “higher-level” than C.
In sum: types as first-class objects + low-level bit-fiddling = a
combination unavailable in traditional “low-level” languages like C.
Apart from being an apallingly bit of code.
How would you it less “apallingly”?
(This sentence no verb. Also speling.)
However I can't see the switch-expression; there is a Dict constructor,
where all elements are evaluated, not just the one selected. That is not
how 'switch' works.
How does a switch-expression work, then? Can you give us an example?