Deutsch English Français Italiano |
<v51bb8$2jhji$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: bart <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: Baby X is bor nagain Date: Thu, 20 Jun 2024 14:37:44 +0100 Organization: A noiseless patient Spider Lines: 121 Message-ID: <v51bb8$2jhji$1@dont-email.me> References: <v494f9$von8$1@dont-email.me> <v49seg$14cva$1@raubtier-asyl.eternal-september.org> <v49t6f$14i1o$1@dont-email.me> <v4bcbj$1gqlo$1@raubtier-asyl.eternal-september.org> <v4bh56$1hibd$1@dont-email.me> <v4c0mg$1kjmk$1@dont-email.me> <v4c8s4$1lki1$4@dont-email.me> <20240613002933.000075c5@yahoo.com> <v4emki$28d1b$1@dont-email.me> <20240613174354.00005498@yahoo.com> <v4okn9$flpo$2@dont-email.me> <20240617002924.597@kylheku.com> <v4pddb$m5th$1@dont-email.me> <20240618115650.00006e3f@yahoo.com> <v4rv0o$1b7h1$1@dont-email.me> <20240618184026.000046e1@yahoo.com> <v4sd75$1ed31$1@dont-email.me> <877celzx14.fsf@nosuchdomain.example.com> <v4u85k$1t2pu$2@dont-email.me> <v4ucmn$1u14i$1@dont-email.me> <v4v2br$22c0m$1@dont-email.me> <v4v5nu$230rh$2@dont-email.me> <v4vfrn$24rv6$1@dont-email.me> <v4vjs4$25vmc$1@dont-email.me> <v510k3$2hhli$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 20 Jun 2024 15:37:44 +0200 (CEST) Injection-Info: dont-email.me; posting-host="8937c4cd9410af123cfa7e31d192c89d"; logging-data="2737778"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KKWs6FC11OttmM6egePdn" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:94HUoWNdYQRfhHxMYnNnEBP3FTg= In-Reply-To: <v510k3$2hhli$1@dont-email.me> Content-Language: en-GB Bytes: 6503 On 20/06/2024 11:34, David Brown wrote: > On 19/06/2024 23:51, bart wrote: [Discussing Python] >> Pretty much everything can be assigned to (the only exception is >> reserved words). Because every user identifer (even if declared with >> def or class or module) is a variable. > > The concept of "variable" in Python is quite different from that of C. > You can pretend they are similar for very simple Python snippets, but > then you will end up thinking there are lots of arbitrary rules for when > assignment and function parameters are by value or by reference. It is > better to think that all "things" in Python are anonymous > reference-counted objects on the heap. When it looks like you have a > variable, you actually just have a named reference to such objects. > Imagine it more like your "variables" are all "void *" pointers or > references, while all other types and structures are malloc'd. These > references have no type information - but the objects they point to are > all strongly typed. And the objects have reference-counted garbage > collection. You haven't given an opinion. I think this is an unnecessary aspect of it, which also makes it harder to optimise, and to reason about. My languages have perhaps a dozen categories of identifiers, known at compile-time, which include variable names. Python has only one, a 'variable'. It mean this is possible: def F(n): return n + 1 ... F = 42 .... F(x) # will not work when F is 42 In my language (in common with most other sensible ones!), if you really wanted that effect, you do it like this: fun F(n) = n + 1 # F is a function name; it cannot change G := F # G is a variable name; its value can change ... G := 42 .... F(x) # Will always work G(x) # Will not work when G doesn't refer to # a function > That is a way to make structures for interaction with external code - > basically, for when you are connecting to DLLs or so libraries. > >> It's just a big, ugly, kitchen-sink language. They throw in every >> feature they can think of (like C++, possibly why DB likes it) in the >> hope that somewhere in the mess is a solution to your needs. >> >> I'm not surprised it takes 20MB to embed. >> > > Neither Python nor C++ throws in "every feature they can think of" - for > both languages, there is a long process of proposals, discussions, > testing, and consideration of the impact on the rest of the language, > existing code, and possible future language features, before a feature > is included. And /then/ they include the feature! I've long given up keeping track. > Yes, these are big languages. Sometimes big is good, > sometimes it is bad - it would be wildly foolish to think that one > language, or one style of language, is all that people need or want. It's a big language that ignores many fundamental features. My scripting language is smaller and simpler, but it takes care of those because I think they are important. The record example, with variant elements, is defined like this: record point = var x, y end and the C-compatible version, which can also be used to enforce element types, or to save memory if there are large homogeneous arrays of them, like this: type cpoint = int32 x, y end Both have mutable elements. Neither allow arbitrary attributes (so impossible to misspell member names). And if the FFI demands it, pointers to structs or ints can be passed: p := cpoint(10, 20) &p # low-level pointer to the struct &p.x # low-level pointer to the int32 element or even: q := point(10, 20) &q.x # low-level pointer to the now int64 element It just works with no fuss, with no need for add-ons, or decorators, and using the same syntax you'd use in static language that uses records and structs. I was aware of Python during the 1990s. My own scripting language was ungainly; so was Python. At one point I needed to bolt-on byte-arrays; so did Python! But Python even then completely disregarded performance. In the 1990s, if you wrote a loop like this: for i in range(1000000): .... it would actually create an object with a million elements so that you could iterate along it. It sounds absolutely crazy, and it was. Later they added xrange() which didn't do that, and later on 'xrange' morphed into 'range'.