Thread View: comp.lang.c
177 messages
177 total messages
Page 4 of 4
Started by fir
Sun, 22 Nov 2026 13:03
Page 4 of 4 ⢠177 total messages
Re: C and its peasant 'ancestors'
Author: Dan Cross
Date: Mon, 30 Nov 2026 00:23
Date: Mon, 30 Nov 2026 00:23
103 lines
5832 bytes
5832 bytes
In article <11eieib$3v2hj$1@kst.eternal-september.org>, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: >cross@spitfire.i.gajendra.net (Dan Cross) writes: >> In article <20261130010153.00003664@yahoo.com>, >> Michael S <already5chosen@yahoo.com> wrote: >[...] >>>There is a whole continuum of possibilities between strongly typed and >>>untyped. >> >> Then you should explain yourself. >> >> "Python is strongly typed. It is of little practical >> importance." What, precisely, did you mean? And why do you >> consider it of, "little importance?" > >I think this is devolving into an debate that's mostly about the >meanings of English phrases like "strongly typed" rather than about the >semantics of various programming languages. > >I do agree that if someone is going to say a language is "strongly >typed", they should probably explain just what they mean by that. > >I'm not aware that there's any widely accepted definition of >"strongly typed". And I would argue that "strong typing" cannot >be measured along a single continuum, with "weakly typed" languages >at one end and "strongly typed" languages at the other. One language >might have strong typing enforced at run time; another might have >weak typing enforced at compile time. No, these terms of art that are, as I understand it, fairly well understood in the PL community. Generally, "strong typed" means "no implicit conversions", and "statically typed" means "types are known at compile time." I do agree that there are languages that are more strongly or weakly typed than others; on the one hand, assembly languages tend not to have any notion of type at all: they work in terms of different sized pieces of memory and registers of various kinds. But if you want to load bytes from a string into a floating-point register most hardware won't stop you (though you may get an exception if you try to _use_ those bytes). Towards the weaker end you've got languages like C and COBOL; at the stricter side you've got languages based on affine and linear types; Rust, Idris, and so on. On the strictest end you've got, I dunno, the typed lambda calculus or something. Many (most?) interpreted languages (Python, Ruby, Tcl, Perl, Lua, and so on) as well as most Lisps are dynamically typed; the type of an object is a runtime property, and the type of the object associated with an identifier might chaghe over time. >> To tie this back to C, C is a weakly-typed language; add a >> number to a string literal and the result is a pointer. This >> has been a source of a _huge_ number of bugs over the years. > >I can imagine a definition of "weakly-typed" that applies to C, >probably based on its rather promiscuous implicit conversions. On >the other hand, every C expression has an unambiguous type, determined >entirely by the expression itself and the rules of the language. Just so. C is a curious beast that is statically but weakly typed. >(The conversion/adjustment of expressions of function an array >type is arguably an exception to this, but one that's completely >specified by the language rules). > >Adding an integer to a string literal yields a pointer because >(a) an array expression, such as a string literal, is "converted" >to a pointer expression in most contexts, and (b) there exists an >addition operator that takes a pointer and an integer and yields >a pointer. (And I'm skeptical that this has been a source of a >huge number of bugs.) Python allows a string to be multiplied by >an integer; "foo" * 3 yields "foofoofoo". Sure; we know _why_ C does this. But it is an example of weak typing. As for bugs....Consider how many "off-by-one" bugs have resulted from C's loose treatment of pointer arithmetic. Most languages that provide non-nullable references don't allow you to perform arithmetic on them at all. >In a typical assembly language, you can load two floating-point values >into registers and apply a bitwise xor to them as easily as you can >multiply them. You can't do that in most higher-level languages, >including C, without extra steps that make the weirdness explicit. In >Python, you can assign an expression of any type to a variable named >"x"; the type is associated with the value, not with the variable. >C doesn't do that. I would argue that most assembly languages are >very weakly typed, but I wouldn't necessary say that C is more >strongly typed than Python is or vice versa. Yes. I agree that assembly languages are weakly typed; however, your Python example is along the dimension of being dynamically typed: you can't perform arithmetic addition on a list in Python while you can in C: assuming a _linked list_ in C, this is almost certainly an error (as opposed to following a `next` pointer or whatever), whereas in Python it's just not expressible. - Dan C.
Re: C and its peasant 'ancestors'
Author: Lawrence DâOliveiro
Date: Mon, 30 Nov 2026 00:31
Date: Mon, 30 Nov 2026 00:31
20 lines
2560 bytes
2560 bytes
On Sun, 29 Nov 2026 20:36:18 +0100, Bonita Montero wrote: > Am 29.11.2026 um 20:21 schrieb Lawrence DâOliveiro: > >> On Sun, 29 Nov 2026 20:08:10 +0100, Bonita Montero wrote: > >>> Virtual functions in C++ need less storage since you need only one >>> virtual method table pointer per baseclass. > >> Thatâs actually a limitation, because it disallows >> âmonkey-patchingâ. > > When do you need to change the polymorphic type of a class at > runtime. In OOP languages no one has missed that feature so far. On the contrary. True OO languages at least offer it as an option, best used sparingly. <https://stackoverflow.com/questions/5626193/what-is-monkey-patching> <https://www.reddit.com/r/ruby/comments/n0n6e/whats_the_deal_with_monkeypatching_and_why_is/>
Re: C and its peasant 'ancestors'
Author: Keith Thompson
Date: Mon, 30 Nov 2026 01:21
Date: Mon, 30 Nov 2026 01:21
45 lines
3480 bytes
3480 bytes
cross@spitfire.i.gajendra.net (Dan Cross) writes:
> In article <11eieib$3v2hj$1@kst.eternal-september.org>,
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
[...]
>>I'm not aware that there's any widely accepted definition of
>>"strongly typed". And I would argue that "strong typing" cannot
>>be measured along a single continuum, with "weakly typed" languages
>>at one end and "strongly typed" languages at the other. One language
>>might have strong typing enforced at run time; another might have
>>weak typing enforced at compile time.
>
> No, these terms of art that are, as I understand it, fairly well
> understood in the PL community. Generally, "strong typed" means
> "no implicit conversions", and "statically typed" means "types
> are known at compile time."
You may well be right about that. On the other hand, I think there
are a lot of people who don't use the terms that way, and some of
them participate in discussions like this one. (I'm not referring
to anyone in particular.)
In the particular case of "hello" + 1 being valid in C, there are
two things going on. One is the implicit conversion of the array
expression "hello" to a pointer expression; that's weak typing.
The other is the existence of a + operator that takes pointer and
integer operands; that's just a weird operator, no more weakly
typed than Pythons "foo" * 3" or Perl's "foo" x 3.
A digression: I'm not happy that C's array-to-pointer conversion is
referred to as a "conversion". It's not like other type conversions.
An ordinary type conversion is an operation (either performed
implicitly or specified by a cast operator) that takes an operand of
some type, and the result depends only on the *value* of the operand.
It notionally happens at run time, but can sometimes be optimized
to occur at compile time.
The array-to-pointer conversion could more accurately be described as
a compile-time *adjustment*, similar to the array-to-pointer parameter
adjustment (for which the standard does use the word "adjusted").
Likewise for function-to-pointer conversions.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Re: C and its peasant 'ancestors'
Author: Dan Cross
Date: Mon, 30 Nov 2026 02:25
Date: Mon, 30 Nov 2026 02:25
96 lines
5383 bytes
5383 bytes
In article <11eij2a$hq5$1@kst.eternal-september.org>, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: >cross@spitfire.i.gajendra.net (Dan Cross) writes: >> In article <11eieib$3v2hj$1@kst.eternal-september.org>, >> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: >[...] >>>I'm not aware that there's any widely accepted definition of >>>"strongly typed". And I would argue that "strong typing" cannot >>>be measured along a single continuum, with "weakly typed" languages >>>at one end and "strongly typed" languages at the other. One language >>>might have strong typing enforced at run time; another might have >>>weak typing enforced at compile time. >> >> No, these terms of art that are, as I understand it, fairly well >> understood in the PL community. Generally, "strong typed" means >> "no implicit conversions", and "statically typed" means "types >> are known at compile time." > >You may well be right about that. On the other hand, I think there >are a lot of people who don't use the terms that way, and some of >them participate in discussions like this one. (I'm not referring >to anyone in particular.) Perhaps; I'm not in anyone else's head so I don't know how they conceptualize these things, but programming languages are a domain within computer science (actually, I suppose within the intersection of a few different fields) and domain nomenclature has meaning within that domain. It is fine not to know the nomenclature; it is not fine to say that it means something different with respect to the domain because someone is not deeply immersed in the field. And I say that as someone who is not a PL person: I'm an OS person. >In the particular case of "hello" + 1 being valid in C, there are >two things going on. One is the implicit conversion of the array >expression "hello" to a pointer expression; that's weak typing. >The other is the existence of a + operator that takes pointer and >integer operands; that's just a weird operator, no more weakly >typed than Pythons "foo" * 3" or Perl's "foo" x 3. I'd put the whole thing in C more succinctly: it's an accident of history. B had no types other than a "word"; memory was viewed as an array of words. As Dennis Ritchie put it in his C history paper from HOPL III, |Because pointers in BCPL and B are merely integer indices in |the memory array, arithmetic on them is meaningful: if `p` is |the address of a ceil, then `p + 1` is the address of the next |cell. This convention is the basis for the semantics of arrays |in both languages". He goes on to explain what `auto V[10]` means as a result: |...a cell named `V` is allocated, then another group of 10 |contiguous cells is set aside, and the memory index of the |first of these is placed into `V`. By a general rule, in B, |the expression `*(V + i)` adds `V` and `i`, and refers to the |`i`-th location after `V`. Both BCPL and B each add special |notation to sweeten such array accesses; in B, an equivalent |expression is `V[i]`.... The rest is literally history. https://dl.acm.org/doi/epdf/10.1145/234286.1057834 >A digression: I'm not happy that C's array-to-pointer conversion is >referred to as a "conversion". It's not like other type conversions. >An ordinary type conversion is an operation (either performed >implicitly or specified by a cast operator) that takes an operand of >some type, and the result depends only on the *value* of the operand. >It notionally happens at run time, but can sometimes be optimized >to occur at compile time. > >The array-to-pointer conversion could more accurately be described as >a compile-time *adjustment*, similar to the array-to-pointer parameter >adjustment (for which the standard does use the word "adjusted"). > >Likewise for function-to-pointer conversions. To be provocative, I think it is easier to conceptualize if one thinks of C as lacking first-class array types. Rather, C has pointers to contiguous regions of memory of some size; the array-like notation is just syntactic sugar around this. Btw, in the Q&A transcript at the above link, Ritchie says this when asked about C declaration syntax: |It was Ravi Sethi who observed that if C's unary star operator |were a postfix operator instead of a prefix operator, suddenly |everything becomes nice and linear and clear. (Now excuse me, I am ducking and running for cover....) - Dan C.
Re: C and its peasant 'ancestors'
Author: Keith Thompson
Date: Mon, 30 Nov 2026 02:50
Date: Mon, 30 Nov 2026 02:50
37 lines
2868 bytes
2868 bytes
cross@spitfire.i.gajendra.net (Dan Cross) writes:
[...]
> To be provocative, I think it is easier to conceptualize if one
> thinks of C as lacking first-class array types. Rather, C has
> pointers to contiguous regions of memory of some size; the
> array-like notation is just syntactic sugar around this.
This could lead to a lengthy discussion about what "first-class"
means. I'm not sure I want to participate in it.
My point of view is that C very definitely has array types, array
objects, array expressions, even array values. (A "value" is the
"precise meaning of the contents of an object when interpreted as
having a specific type". An array value consists of the values
of its elements.) It just restricts certain operations on array
types/objects/expressions/values.
My preference is to think about C as it's currently defined. It's
certainly important to understand where C's quirks came from, but
dmr and WG14 went to a great deal of effort to define C in its own
internally consistent terms. Understanding B certainly helps, but
it shouldn't be *necessary*.
> Btw, in the Q&A transcript at the above link, Ritchie says this
> when asked about C declaration syntax:
>
> |It was Ravi Sethi who observed that if C's unary star operator
> |were a postfix operator instead of a prefix operator, suddenly
> |everything becomes nice and linear and clear.
>
> (Now excuse me, I am ducking and running for cover....)
Ah, what might have been.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Re: C and its peasant 'ancestors'
Author: Bonita Montero
Date: Mon, 30 Nov 2026 03:25
Date: Mon, 30 Nov 2026 03:25
9 lines
1797 bytes
1797 bytes
Am 29.11.2026 um 23:45 schrieb Dan Cross: > It's actually not even that hard. Most class instances have a > single pointer to a vtbl; you can "monkey patch" C++ just by > replacing that with a pointer to a different table that points > to a different thunk. It is hard since a different class has a different object layout with different state.
Re: C and its peasant 'ancestors'
Author: Dan Cross
Date: Mon, 30 Nov 2026 04:04
Date: Mon, 30 Nov 2026 04:04
16 lines
1447 bytes
1447 bytes
In article <11eiqbe$332f$1@raubtier-asyl.eternal-september.org>, Bonita Montero <Bonita.Montero@gmail.com> wrote: >Am 29.11.2026 um 23:45 schrieb Dan Cross: > >> It's actually not even that hard. Most class instances have a >> single pointer to a vtbl; you can "monkey patch" C++ just by >> replacing that with a pointer to a different table that points >> to a different thunk. > >It is hard since a different class has a different object layout >with different state. Hence thunks. - Dan C.
Re: C and its peasant 'ancestors'
Author: Dan Cross
Date: Mon, 30 Nov 2026 04:24
Date: Mon, 30 Nov 2026 04:24
87 lines
4131 bytes
4131 bytes
In article <11eio9n$28j2$1@kst.eternal-september.org>,
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>cross@spitfire.i.gajendra.net (Dan Cross) writes:
>[...]
>> To be provocative, I think it is easier to conceptualize if one
>> thinks of C as lacking first-class array types. Rather, C has
>> pointers to contiguous regions of memory of some size; the
>> array-like notation is just syntactic sugar around this.
>
>This could lead to a lengthy discussion about what "first-class"
>means. I'm not sure I want to participate in it.
>
>My point of view is that C very definitely has array types, array
>objects, array expressions, even array values. (A "value" is the
>"precise meaning of the contents of an object when interpreted as
>having a specific type". An array value consists of the values
>of its elements.)
Certainly, that's a valid viewpoint. But consider this:
struct A {
char a[10];
};
struct A foo(void) { return (struct A){ .a = " ... " }; }
char *bar(void) { return " ... "; }
There's no way to "return" an array from a function. Unless the
array is embedded in a `struct`. :-/
>It just restricts certain operations on array
>types/objects/expressions/values.
Well, that's precisely what it means not to be first-class, no?
>My preference is to think about C as it's currently defined. It's
>certainly important to understand where C's quirks came from, but
>dmr and WG14 went to a great deal of effort to define C in its own
>internally consistent terms. Understanding B certainly helps, but
>it shouldn't be *necessary*.
Indeed, it is not strictly necessary. But if one wants to know
_why_ C is the way that it is, it helps to know the history,
including the pecularities of the languages leading up to it,
and that were major influences on its design.
In this case, I brought up the pecularity of adding a number to
a string yielding a pointer as an example of weak typing; I
think it fair to say that most of the people participating here
know _what_ is happening there (you yourself wrote about it a
couple of responses ago), but explaining what is going on was
beside the point.
Perhaps a better example might have been something like this:
struct foo {
int a;
int b;
char *p;
};
struct foo foo[0x100] = { ... };
void *ptr = foo + 'A';
Of course we can explain _what_ is going on here: 'A' is an
integer type with some value (on my system, 0x41), and the
unadorned `foo` in the assignment decays to a pointer, and we
can certainly assign that to a `void *`, so we are just doing
pointer arithmetic; I can even think of valid reasons why one
might do exactly this. But it is precisely the sort of thing
that weakly typed languages let you do.
>> Btw, in the Q&A transcript at the above link, Ritchie says this
>> when asked about C declaration syntax:
>>
>> |It was Ravi Sethi who observed that if C's unary star operator
>> |were a postfix operator instead of a prefix operator, suddenly
>> |everything becomes nice and linear and clear.
>>
>> (Now excuse me, I am ducking and running for cover....)
>
>Ah, what might have been.
The one that got away.
- Dan C.
Re: C and its peasant 'ancestors'
Author: Bonita Montero
Date: Mon, 30 Nov 2026 05:46
Date: Mon, 30 Nov 2026 05:46
10 lines
1678 bytes
1678 bytes
Am 30.11.2026 um 05:04 schrieb Dan Cross: > In article <11eiqbe$332f$1@raubtier-asyl.eternal-september.org>, >> It is hard since a different class has a different object layout >> with different state. > Hence thunks. ???
Re: C and its peasant 'ancestors'
Author: Lawrence DâOliveiro
Date: Mon, 30 Nov 2026 06:01
Date: Mon, 30 Nov 2026 06:01
6 lines
1471 bytes
1471 bytes
On Mon, 30 Nov 2026 06:46:49 +0100, Bonita Montero wrote: >> Hence thunks. > ??? <https://en.wikipedia.org/wiki/Thunk>
Re: C and its peasant 'ancestors'
Author: Bonita Montero
Date: Mon, 30 Nov 2026 06:02
Date: Mon, 30 Nov 2026 06:02
7 lines
1706 bytes
1706 bytes
Am 30.11.2026 um 00:10 schrieb Dan Cross: > To tie this back to C, C is a weakly-typed language; add a > number to a string literal and the result is a pointer. This > has been a source of a _huge_ number of bugs over the years. That's a matter of semantics and not of stongly vs. weakly typed.
Re: C and its peasant 'ancestors'
Author: Tim Rentsch
Date: Mon, 30 Nov 2026 07:33
Date: Mon, 30 Nov 2026 07:33
34 lines
3254 bytes
3254 bytes
Lawrence DâOliveiro <ldo@nz.invalid> writes: > On Sat, 28 Nov 2026 06:30:02 +0100, Bonita Montero wrote: > >> Am 27.11.2026 um 22:26 schrieb Lawrence D?Oliveiro: >> >>> On Thu, 26 Nov 2026 10:44:37 +0100, Bonita Montero wrote: >>> >>>> I'm not into C++ but also into Rust and some other languages. Both >>>> mentioned languages are superior to C by magnitudes. You need only >>>> a fifth of the code and the code is more readable. >>> >>> I?m sure Python beats them all, on that score. >> >> An not strongly typed and interpreted language ? > > It *is* strongly-typed, and compiled. The problem is "strongly typed" means different things to different people. There is no authoritative definition. In what may be the earliest definition, a 1974 paper by Liskov and Zilles defined the term "strongly typed language" in a way that does not include how Python treats functions and expressions, etc. The difficulty is made worse by language creep in related areas. The word "type" is a good example. In a paper by Dan Ingalls and Alan Borning on Adding types to Smalltalk (1982 POPL if I remember right), they say classes are not types. These days a lot of people would disagree with that, but they are using the word "type" with a different meaning than what Ingalls and Borning meant. It's useless to argue about the meaning of words and phrases when the meanings change, not just from time to time but from person to person. The C language satisfies some definitions of "strongly typed". Unfortunately that statement by itself doesn't tell us anything useful about C, because "strongly typed" doesn't have a fixed meaning.
Re: C and its peasant 'ancestors'
Author: David Brown
Date: Mon, 30 Nov 2026 08:34
Date: Mon, 30 Nov 2026 08:34
64 lines
4614 bytes
4614 bytes
On 28/11/2026 19:12, bartc wrote:
> On 28/11/2026 16:31, Bonita Montero wrote:
>> Am 28.11.2026 um 16:28 schrieb bartc:
>>
>>> Yet every example of C++ you've ever posted is always an unreadable,
>>> ugly mess of syntax.
>>
>> A very disordered opinion.
>>
>>> Not all that is the fault of the language - you seem to delight in
>>> using every obscure feature possible and have nested functions
>>> everywhere.
>>
>> C++-developers understand my code since they're more skilled like you.
>
> It's not a skills issue. The language as used like this is several times
> more complex than is needed.
>
>
>>> Below is a recent post of yours about sorting in C++. It took me a
>>> while to realise it was actually testing two kinds of sort!
>>
>> I don't know why this should be hard to understand.
>> Maybe it's beyond your capabilities.
>
> Because it's a ******* mess. Here's a function you created simply for
> copying one array to another:
>
> Â Â auto cpy = [&] { copy( origin.begin(), origin.end(), srt.begin() );
> dummy += srt[0]; };
>
As a small point here - local lambdas like this are sometimes very handy
in C++ to reduce duplication of code. If you find yourself repeating
roughly the same bit of code a number of times within one function,
there are several ways to handle it.
Copy-and-paste is the obvious one, and sometimes this simple solution is
the best - it's clear what you are doing, but any changes you make later
must be copied-and-pasted too.
You can extract the code to an external "static inline" function, but
that might mean passing a lot of local variables as parameters, and if
you want "pass by reference" in C, that means going via pointers. The
resulting code will be efficient when the compiler inlines it, but it
can be messy.
You can extract the code to an external macro. That saves you from
passing all the local variables, but macros have no scope, and
multi-line macros are messy.
You can use the gcc local function extension, but that is not portable.
In C++, you can use lambdas. For such usage, it is just a way of making
a local function with convenient access to other local variables, and it
will be complied like local inline code.
There is a serious proposal to add lambdas to C, but the design still
has issues before it can make it to the standard.
(This lambda is completely unnecessary in Bonita's code - that code
should have used std::array<> types rather than std::vector<> types, and
the copy would have been done as "srt = origin;".)
Re: C and its peasant 'ancestors'
Author: David Brown
Date: Mon, 30 Nov 2026 08:44
Date: Mon, 30 Nov 2026 08:44
66 lines
3309 bytes
3309 bytes
On 29/11/2026 20:08, Bonita Montero wrote:
> Am 29.11.2026 um 17:19 schrieb Scott Lurndal:
>
>> Commercial operating systems have used "virtual functions" in C pretty
>> extensively over the last forty years (consider the Unix VFS layer
>> or generic device driver interfaces for example).
>
> Virtual functions in C++ need less storage since you need only one
> virtual method table pointer per baseclass. C-code is typically with
> one fuction pointer as a struct member. And C++ virtual functions are
> easier to handle since they're automatically set by the constructor.
>
>
True.
But they are also more indirect than function pointers contained
directly in a struct (the common C method). This can sometimes be
significant, so there are pros and cons to both solutions. The virtual
method table is usually the better tradeoff, which is why it is used by
C++, but it is not always so.
And of course you can do the same in C, albeit with more manual coding.
// C++
struct Foo {
int x;
int y;
virtual void do_this();
virtual int do_that(int z);
};
Foo foo;
foo.do_this();
// C with "traditional" C virtual functions:
struct Foo {
int x;
int y;
void (*do_this)(void);
int (*do_that)(int z);
};
struct Foo foo;
foo.do_this();
// C with virtual method table :
struct Foo_methods {
void (*do_this)(void);
int (*do_that)(int z);
};
struct Foo {
struct Foo_methods * p_vmt;
int x;
int y;
};
struct Foo foo;
foo.p_vmt->do_this();
Re: C and its peasant 'ancestors'
Author: David Brown
Date: Mon, 30 Nov 2026 09:25
Date: Mon, 30 Nov 2026 09:25
74 lines
4615 bytes
4615 bytes
On 30/11/2026 05:24, Dan Cross wrote:
> In article <11eio9n$28j2$1@kst.eternal-september.org>,
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> cross@spitfire.i.gajendra.net (Dan Cross) writes:
>> [...]
>>> To be provocative, I think it is easier to conceptualize if one
>>> thinks of C as lacking first-class array types. Rather, C has
>>> pointers to contiguous regions of memory of some size; the
>>> array-like notation is just syntactic sugar around this.
>>
>> This could lead to a lengthy discussion about what "first-class"
>> means. I'm not sure I want to participate in it.
>>
>> My point of view is that C very definitely has array types, array
>> objects, array expressions, even array values. (A "value" is the
>> "precise meaning of the contents of an object when interpreted as
>> having a specific type". An array value consists of the values
>> of its elements.)
>
> Certainly, that's a valid viewpoint. But consider this:
>
> struct A {
> char a[10];
> };
>
> struct A foo(void) { return (struct A){ .a = " ... " }; }
> char *bar(void) { return " ... "; }
>
> There's no way to "return" an array from a function. Unless the
> array is embedded in a `struct`. :-/
>
>> It just restricts certain operations on array
>> types/objects/expressions/values.
>
> Well, that's precisely what it means not to be first-class, no?
>
I'd agree with that definition.
In C, you can wrap data in a struct (or a union) and you now have a
strong type. There are no implicit conversions between different struct
types, or pointers to them - that is as strong as it gets.
Discussions about "strongly" and "weakly" typed languages often face
three problems (some of which have been pointed out before - and I am
not referring to any particular person here!).
First, people sometimes misunderstand the distinction between static
versus dynamic typing and strong versus weak typing.
Second, people often think, or at least write as though they think, that
these things are binary choices. Someone might say "Python is strongly
typed, C is weakly typed". Yet the above example of "struct A" shows
that you can use strong types in C. Allowing "123" + 2 as a valid
expression is seen as an example of why C is called "weakly typed" - yet
Python allows you to write "123" * 2 while still being called "strongly
typed". Even static or dynamic typing is not a binary choice - consider
runtime polymorphism in C++.
Thirdly, people often seem to think that weak versus strong typing is a
scale - an "axis". While this is less of an oversimplification than
viewing it as a binary choice, it is still a massive oversimplification.
A scale implies consistency of features and order amongst languages
that simply does not exist. Languages differ significantly in the
implicit and explicit conversions they allow between types, how they
handle operators on different types, and how much control they give the
programmer for how this works on their own types.
I think it is okay to have brief summaries - "Python has dynamic strong
typing, C has static weak typing". But those are vague, relative
statements that miss much of the important details.
Re: C and its peasant 'ancestors'
Author: David Brown
Date: Mon, 30 Nov 2026 09:25
Date: Mon, 30 Nov 2026 09:25
54 lines
3459 bytes
3459 bytes
On 30/11/2026 00:48, Chris M. Thomasson wrote: > On 11/29/2026 3:01 PM, Michael S wrote: >> On Sun, 29 Nov 2026 22:48:51 -0000 (UTC) >> cross@spitfire.i.gajendra.net (Dan Cross) wrote: >> >>> In article <20261130000723.0000290f@yahoo.com>, >>> Michael S <already5chosen@yahoo.com> wrote: >>>> On Sun, 29 Nov 2026 04:22:25 -0000 (UTC) >>>> cross@spitfire.i.gajendra.net (Dan Cross) wrote: >>>>> In article <20261128201354.000064be@yahoo.com>, >>>>> Michael S <already5chosen@yahoo.com> wrote: >>>>>> On Sat, 28 Nov 2026 12:26:54 -0000 (UTC) >>>>>> cross@spitfire.i.gajendra.net (Dan Cross) wrote: >>>>>>> In article >>>>>>> <11eds8o$2ahsb$2@raubtier-asyl.eternal-september.org>, Bonita >>>>>>> Montero <Bonita.Montero@gmail.com> wrote: >>>>>>>> Am 28.11.2026 um 06:50 schrieb Lawrence >>>>>>>> DĂĆĂ¢Ă¢ââŹĹĄĂÂŹĂ¢ââŹĹžĂ¢Oliveiro: >>>>>>>>> It *is* strongly-typed, and compiled. >>>>>>>> >>>>>>>> Python is weakly typed. >>>>>>>> Type annotations aren't enforced by the compiler. >>>>>>> >>>>>>> Lawrence is an idiot, but he's right about this.  Python >>>>>>> is _strongly_ typed, but it is not _statically_ typed. >>>>>> >>>>>> Weak or strong - it's not very important in practice. >>>>> >>>>> You mean static versus dynamic. >>>> >>>> No, I meant exactly what I wrote. >>> >>> What you wrote was unclear. >>> >>>> Python is strongly typed. It is of little practical importance. >>> >>> Then you're wrong. Strong typing is _essential_ to avoid >>> getting garbage results. >> >> There is a whole continuum of possibilities between strongly typed and >> untyped. >> >>> Adding 1 to a linked-list is a mistake >>> that should be caught somehow; whether at runtime (as in a >>> dynamic) language or at compile-time as in a statically typed >>> langauge is, as I said, a different axis. >>> >>>> Python lacks static checks. It is of higher importance. >>> >>> Without strong typing what would it check? > Are you a fan of duck typing? ;^) I find my pet cat types better than my pet duck.
Re: C and its peasant 'ancestors'
Author: Ross Finlayson
Date: Mon, 30 Nov 2026 09:28
Date: Mon, 30 Nov 2026 09:28
51 lines
3770 bytes
3770 bytes
On 11/29/2026 07:25 PM, Bonita Montero wrote: > Am 29.11.2026 um 23:45 schrieb Dan Cross: > >> It's actually not even that hard. Most class instances have a >> single pointer to a vtbl; you can "monkey patch" C++ just by >> replacing that with a pointer to a different table that points >> to a different thunk. > > It is hard since a different class has a different object layout > with different state. C++ since "move semantics" which used to be called "re-seating the reference", which wasn't itself a thing in the language, since nothing's to actually "move" except the pointer, about "returning references" to values that don't exist when they're return-results instead of temporary-results, has that "move semantics" then about "ref" and "ref-ref" both conflating return-results and temporary-results, then "splitting into another dialect the templates" the "forwarding-reference" and "universal-reference" and doing the "overloading const", seems a bit the "primrose path" and not all would suggest it. Usual ideas of "multiple-inheritance is hard" also makes for "multiple-inheritance breaks monkey-patching". The "smart-pointer" then about how to make for "depth-count" past "ref-count" on the smart-pointer, not a shared-pointer just a passed-pointer, is a page or so of code. Of course C++ was written with smart-pointers before move-semantics for a perceived "simplicity's" sake basically conflated lifetime with scope. C then is for that pointers then layers of pointer-indirection, have that "**" is basically at least two different types according to whether it's a return-result (an out-parameter) or a temporary-result, _or_, for example, where it's "pointer in front of array so pointer-decay of types results array of fixed-length". The "smart-pointer" then for a "smart-depth-pointer", basically involves in C++ an object to access the smart-depth-pointer, so the object lives according to block/function scope and then as for it being surfaced, has that it either lives on the heap or it doesn't. Or, "the move-semantics the syntactic-sugar is a bit the bitter-pill".
Re: C and its peasant 'ancestors'
Author: Ross Finlayson
Date: Mon, 30 Nov 2026 09:48
Date: Mon, 30 Nov 2026 09:48
112 lines
6823 bytes
6823 bytes
On 11/29/2026 06:25 PM, Dan Cross wrote: > In article <11eij2a$hq5$1@kst.eternal-september.org>, > Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: >> cross@spitfire.i.gajendra.net (Dan Cross) writes: >>> In article <11eieib$3v2hj$1@kst.eternal-september.org>, >>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: >> [...] >>>> I'm not aware that there's any widely accepted definition of >>>> "strongly typed". And I would argue that "strong typing" cannot >>>> be measured along a single continuum, with "weakly typed" languages >>>> at one end and "strongly typed" languages at the other. One language >>>> might have strong typing enforced at run time; another might have >>>> weak typing enforced at compile time. >>> >>> No, these terms of art that are, as I understand it, fairly well >>> understood in the PL community. Generally, "strong typed" means >>> "no implicit conversions", and "statically typed" means "types >>> are known at compile time." >> >> You may well be right about that. On the other hand, I think there >> are a lot of people who don't use the terms that way, and some of >> them participate in discussions like this one. (I'm not referring >> to anyone in particular.) > > Perhaps; I'm not in anyone else's head so I don't know how they > conceptualize these things, but programming languages are a > domain within computer science (actually, I suppose within the > intersection of a few different fields) and domain nomenclature > has meaning within that domain. > > It is fine not to know the nomenclature; it is not fine to say > that it means something different with respect to the domain > because someone is not deeply immersed in the field. And I say > that as someone who is not a PL person: I'm an OS person. > >> In the particular case of "hello" + 1 being valid in C, there are >> two things going on. One is the implicit conversion of the array >> expression "hello" to a pointer expression; that's weak typing. >> The other is the existence of a + operator that takes pointer and >> integer operands; that's just a weird operator, no more weakly >> typed than Pythons "foo" * 3" or Perl's "foo" x 3. > > I'd put the whole thing in C more succinctly: it's an accident > of history. B had no types other than a "word"; memory was > viewed as an array of words. As Dennis Ritchie put it in his C > history paper from HOPL III, > > |Because pointers in BCPL and B are merely integer indices in > |the memory array, arithmetic on them is meaningful: if `p` is > |the address of a ceil, then `p + 1` is the address of the next > |cell. This convention is the basis for the semantics of arrays > |in both languages". > > He goes on to explain what `auto V[10]` means as a result: > > |...a cell named `V` is allocated, then another group of 10 > |contiguous cells is set aside, and the memory index of the > |first of these is placed into `V`. By a general rule, in B, > |the expression `*(V + i)` adds `V` and `i`, and refers to the > |`i`-th location after `V`. Both BCPL and B each add special > |notation to sweeten such array accesses; in B, an equivalent > |expression is `V[i]`.... > > The rest is literally history. > > https://dl.acm.org/doi/epdf/10.1145/234286.1057834 > >> A digression: I'm not happy that C's array-to-pointer conversion is >> referred to as a "conversion". It's not like other type conversions. >> An ordinary type conversion is an operation (either performed >> implicitly or specified by a cast operator) that takes an operand of >> some type, and the result depends only on the *value* of the operand. >> It notionally happens at run time, but can sometimes be optimized >> to occur at compile time. >> >> The array-to-pointer conversion could more accurately be described as >> a compile-time *adjustment*, similar to the array-to-pointer parameter >> adjustment (for which the standard does use the word "adjusted"). >> >> Likewise for function-to-pointer conversions. > > To be provocative, I think it is easier to conceptualize if one > thinks of C as lacking first-class array types. Rather, C has > pointers to contiguous regions of memory of some size; the > array-like notation is just syntactic sugar around this. > > Btw, in the Q&A transcript at the above link, Ritchie says this > when asked about C declaration syntax: > > |It was Ravi Sethi who observed that if C's unary star operator > |were a postfix operator instead of a prefix operator, suddenly > |everything becomes nice and linear and clear. > > (Now excuse me, I am ducking and running for cover....) > > - Dan C. > That's one of the problems or ambiguities of C the East/West of the pointers vis-a-vis the qualifiers, here with "pointers West, qualifiers East", and that the pointers always go on the type when they're declared not when they're referenced thusly on the value, since nobody needs to write "int a, *pa" when they can write "int a; int* pa", then that const should pick a side basically for having qualifiers after so they're not ambiguous in the middle. A pointer in a declaration is not an operator, it's a type-modifier. (Any conflict with the actual standard these terms would be un-intended.)
Re: C and its peasant 'ancestors'
Author: Ross Finlayson
Date: Mon, 30 Nov 2026 09:52
Date: Mon, 30 Nov 2026 09:52
63 lines
4363 bytes
4363 bytes
On 11/30/2026 01:28 AM, Ross Finlayson wrote: > On 11/29/2026 07:25 PM, Bonita Montero wrote: >> Am 29.11.2026 um 23:45 schrieb Dan Cross: >> >>> It's actually not even that hard. Most class instances have a >>> single pointer to a vtbl; you can "monkey patch" C++ just by >>> replacing that with a pointer to a different table that points >>> to a different thunk. >> >> It is hard since a different class has a different object layout >> with different state. > > C++ since "move semantics" which used to be called "re-seating the > reference", which wasn't itself a thing in the language, since nothing's > to actually "move" except the pointer, about "returning references" to > values that don't exist when they're return-results instead of > temporary-results, has that "move semantics" then about "ref" and > "ref-ref" both conflating return-results and temporary-results, then > "splitting into another dialect the templates" the > "forwarding-reference" and "universal-reference" and doing the > "overloading const", seems a bit the "primrose path" and not all would > suggest it. > > Usual ideas of "multiple-inheritance is hard" also makes for > "multiple-inheritance breaks monkey-patching". > > The "smart-pointer" then about how to make for "depth-count" > past "ref-count" on the smart-pointer, not a shared-pointer just > a passed-pointer, is a page or so of code. Of course C++ was > written with smart-pointers before move-semantics for a perceived > "simplicity's" sake basically conflated lifetime with scope. > > > > C then is for that pointers then layers of pointer-indirection, > have that "**" is basically at least two different types according > to whether it's a return-result (an out-parameter) or a > temporary-result, _or_, for example, where it's "pointer in front of > array so pointer-decay of types results array of fixed-length". > > > The "smart-pointer" then for a "smart-depth-pointer", basically > involves in C++ an object to access the smart-depth-pointer, > so the object lives according to block/function scope and then > as for it being surfaced, has that it either lives on the heap > or it doesn't. > > > Or, "the move-semantics the syntactic-sugar is a bit the bitter-pill". > > > Then if "move-semantics" of "C++11 <-> C++14" is janky, then the various modern accounts of "value-semantics" need refine their accounts since move-semantics should've just added a keyword, and value-semantics have a variety of considered most reasonable overloadings of the operators of the access-patternry. I.e., such things should not be baked into the "standard collections" or "standard containers".
Re: C and its peasant 'ancestors'
Author: Dan Cross
Date: Mon, 30 Nov 2026 12:27
Date: Mon, 30 Nov 2026 12:27
30 lines
1976 bytes
1976 bytes
In article <86se0ikc2w.fsf@linuxsc.com>, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote: >Lawrence DâOliveiro <ldo@nz.invalid> writes: > >> On Sat, 28 Nov 2026 06:30:02 +0100, Bonita Montero wrote: >> >>> Am 27.11.2026 um 22:26 schrieb Lawrence D?Oliveiro: >>> >>>> On Thu, 26 Nov 2026 10:44:37 +0100, Bonita Montero wrote: >>>> >>>>> I'm not into C++ but also into Rust and some other languages. Both >>>>> mentioned languages are superior to C by magnitudes. You need only >>>>> a fifth of the code and the code is more readable. >>>> >>>> I?m sure Python beats them all, on that score. >>> >>> An not strongly typed and interpreted language ? >> >> It *is* strongly-typed, and compiled. > >The problem is "strongly typed" means different things to different >people. There is no authoritative definition. Not really. Of course it's evolved, but now it more or less has a pretty well-defined meaning in context. But of course much in the way of nomenclature has evolved over the near-century with respect to computing. - Dan C.
Re: C and its peasant 'ancestors'
Author: Lawrence DâOliveiro
Date: Mon, 30 Nov 2026 18:35
Date: Mon, 30 Nov 2026 18:35
13 lines
1840 bytes
1840 bytes
On Mon, 30 Nov 2026 07:02:33 +0100, Bonita Montero wrote: > Am 30.11.2026 um 00:10 schrieb Dan Cross: > >> To tie this back to C, C is a weakly-typed language; add a number >> to a string literal and the result is a pointer. This has been a >> source of a _huge_ number of bugs over the years. >> > That's a matter of semantics and not of stongly vs. weakly typed. Python doesnât allow the same mistake. Yes, it is a loophole of the C type system. So yes, you can say that, in this instance, C is âweakly typedâ.
Re: C and its peasant 'ancestors'
Author: Michael S
Date: Mon, 30 Nov 2026 20:40
Date: Mon, 30 Nov 2026 20:40
24 lines
2358 bytes
2358 bytes
On Mon, 30 Nov 2026 18:35:21 -0000 (UTC) Lawrence DâOliveiro <ldo@nz.invalid> wrote: > On Mon, 30 Nov 2026 07:02:33 +0100, Bonita Montero wrote: > > > Am 30.11.2026 um 00:10 schrieb Dan Cross: > > > >> To tie this back to C, C is a weakly-typed language; add a number > >> to a string literal and the result is a pointer. This has been a > >> source of a _huge_ number of bugs over the years. > >> > > That's a matter of semantics and not of stongly vs. weakly typed. > > Python doesnât allow the same mistake. Yes, it is a loophole of the C > type system. So yes, you can say that, in this instance, C is âweakly > typedâ. May be, not in this specific case, but there are places where Python does implicit type conversions. In particular, it routinely implicitly converts int (i.e. bigint) to floating-point. If we follow the most rigorous definition of strong typing, implicit conversions are verboten.
Re: C and its peasant 'ancestors'
Author: Chris M. Thomasson
Date: Tue, 01 Dec 2026 05:23
Date: Tue, 01 Dec 2026 05:23
77 lines
3154 bytes
3154 bytes
On 11/29/2026 9:46 PM, Bonita Montero wrote:
> Am 30.11.2026 um 05:04 schrieb Dan Cross:
>
>> In article <11eiqbe$332f$1@raubtier-asyl.eternal-september.org>,
>
>>> It is hard since a different class has a different object layout
>>> with different state.
>
>> Hence thunks.
> ???
>
Think of storing the original vtable pointer from something, oh, say
like in my code:
https://pastebin.com/raw/f52a443b1
struct device {
struct device_vtable const* vtable;
};
You make another vtable that acts as a proxy for starters, just
intercepts everything then sends along to the stored original vtable:
struct device_vtable* old = device->vtable;
device->vtable = &new;
Then in the new table we simply forward things to the old vtable.
Now, we have a man in the middle.
This can be thunked:
/* Interfaces
____________________________________________________________________*/
#include <stddef.h>
struct object_prv_vtable {
int (*fp_destroy) (void* const);
};
struct device_prv_vtable {
int (*fp_read) (void* const, void*, size_t);
int (*fp_write) (void* const, void const*, size_t);
};
struct device_vtable {
struct object_prv_vtable const object;
struct device_prv_vtable const device;
};
struct device {
struct device_vtable const* vtable;
};
#define object_destroy(mp_self) ( \
(mp_self)->vtable->object.fp_destroy((mp_self)) \
)
#define device_read(mp_self, mp_buf, mp_size) ( \
(mp_self)->vtable->device.fp_read((mp_self), (mp_buf), (mp_size)) \
)
#define device_write(mp_self, mp_buf, mp_size) ( \
(mp_self)->vtable->device.fp_write((mp_self), (mp_buf), (mp_size)) \
)
Re: C and its peasant 'ancestors'
Author: Chris M. Thomasson
Date: Tue, 01 Dec 2026 05:42
Date: Tue, 01 Dec 2026 05:42
115 lines
4166 bytes
4166 bytes
On 11/30/2026 9:23 PM, Chris M. Thomasson wrote:
> Think of storing the original vtable pointer from something, oh, say
> like in my code:
>
> https://pastebin.com/raw/f52a443b1
>
> struct device {
> Â struct device_vtable const* vtable;
> };
>
> You make another vtable that acts as a proxy for starters, just
> intercepts everything then sends along to the stored original vtable:
>
>
>
> struct device_vtable* old = device->vtable;
> device->vtable = &new;
>
> Then in the new table we simply forward things to the old vtable.
>
> Now, we have a man in the middle.
>
> This can be thunked:
Fwiw, here is a stupid crude and quick way to do it. Even though all of
the device internals are private and not exposed to the sample application:
/* Sample Application
____________________________________________________________________*/
static int thunk_object_destroy(void* const);
static int thunk_device_read(void* const, void*, size_t);
static int thunk_device_write(void* const, void const*, size_t);
static struct device_vtable const g_thunk_table = {
{ /* object */
thunk_object_destroy
},
{ /* device */
thunk_device_read,
thunk_device_write
}
};
static struct device_vtable const* g_thunk_old = 0;
int thunk_object_destroy(
void* const self_
) {
printf("thunk_object_destroy(%p)\n", (void*)self_);
return g_thunk_old->object.fp_destroy(self_);
}
int thunk_device_read(
void* const self_,
void* buf,
size_t size
) {
printf("thunk_device_read(%p, %p, %lu)\n",
(void*)self_, buf, (unsigned long)size);
return g_thunk_old->device.fp_read(self_, buf, size);
}
int thunk_device_write(
void* const self_,
void const* buf,
size_t size
) {
printf("thunk_device_write(%p, %p, %lu)\n",
(void*)self_, buf, (unsigned long)size);
return g_thunk_old->device.fp_write(self_, buf, size);
}
void read_write(
struct device* const self
) {
char buf[100];
device_read(self, buf, 50);
device_write(self, buf, 5);
}
int main(void) {
struct device* a_device;
if (! usb_drive_create(&a_device)) {
// thunk it...
g_thunk_old = a_device->vtable;
a_device->vtable = &g_thunk_table;
read_write(a_device);
object_destroy(a_device);
}
return 0;
}
I get:
thunk_device_read(0xb8343c4e32b0, 0xffffd82045c8, 50)
usb_drive_device_read(0xb8343c4e32b0, 0xffffd82045c8, 50)
thunk_device_write(0xb8343c4e32b0, 0xffffd82045c8, 5)
usb_drive_device_write(0xb8343c4e32b0, 0xffffd82045c8, 5)
thunk_object_destroy(0xb8343c4e32b0)
usb_drive_object_destroy(0xb8343c4e32b0)
Re: C and its peasant 'ancestors'
Author: Chris M. Thomasson
Date: Tue, 01 Dec 2026 05:48
Date: Tue, 01 Dec 2026 05:48
125 lines
4757 bytes
4757 bytes
On 11/30/2026 9:23 PM, Chris M. Thomasson wrote:
> On 11/29/2026 9:46 PM, Bonita Montero wrote:
>> Am 30.11.2026 um 05:04 schrieb Dan Cross:
>>
>>> In article <11eiqbe$332f$1@raubtier-asyl.eternal-september.org>,
>>
>>>> It is hard since a different class has a different object layout
>>>> with different state.
>>
>>> Hence thunks.
>> ???
>>
>
> Think of storing the original vtable pointer from something, oh, say
> like in my code:
>
> https://pastebin.com/raw/f52a443b1
>
> struct device {
> Â struct device_vtable const* vtable;
> };
>
> You make another vtable that acts as a proxy for starters, just
> intercepts everything then sends along to the stored original vtable:
>
>
>
> struct device_vtable* old = device->vtable;
> device->vtable = &new;
>
> Then in the new table we simply forward things to the old vtable.
>
> Now, we have a man in the middle.
>
> This can be thunked:[...]
Or even something like, going for a simple wrapper:
/* Sample Application
____________________________________________________________________*/
struct device_thunk {
struct device device;
struct device* target;
};
static int thunk_object_destroy(void* const self_) {
struct device_thunk* const self = self_;
int rc;
printf("thunk_object_destroy(%p -> %p)\n", (void*)self,
(void*)self->target);
rc = object_destroy(self->target);
free(self);
return rc;
}
static int thunk_device_read(void* const self_, void* buf, size_t size) {
struct device_thunk* const self = self_;
printf("thunk_device_read(%p, %p, %lu)\n", (void*)self, buf,
(unsigned long)size);
return device_read(self->target, buf, size);
}
static int thunk_device_write(void* const self_, void const* buf, size_t
size) {
struct device_thunk* const self = self_;
printf("thunk_device_write(%p, %p, %lu)\n", (void*)self, buf,
(unsigned long)size);
return device_write(self->target, buf, size);
}
static struct device_vtable const g_thunk_table = {
{ thunk_object_destroy },
{ thunk_device_read, thunk_device_write }
};
int device_thunk_create(struct device** const pself, struct device*
const target) {
struct device_thunk* const self = malloc(sizeof(*self));
if (self) {
self->device.vtable = &g_thunk_table;
self->target = target;
*pself = &self->device;
return 0;
}
return -1;
}
void read_write(
struct device* const self
) {
char buf[100];
device_read(self, buf, 50);
device_write(self, buf, 5);
}
int main(void) {
struct device* raw_device;
struct device* a_device;
if (! usb_drive_create(&raw_device)) {
if (! device_thunk_create(&a_device, raw_device)) {
read_write(a_device);
object_destroy(a_device); /* destroys raw_device, then frees
wrapper */
} else {
object_destroy(raw_device);
}
}
return 0;
}
I get:
thunk_device_read(0xca5757ebc2d0, 0xffffdff38c28, 50)
usb_drive_device_read(0xca5757ebc2b0, 0xffffdff38c28, 50)
thunk_device_write(0xca5757ebc2d0, 0xffffdff38c28, 5)
usb_drive_device_write(0xca5757ebc2b0, 0xffffdff38c28, 5)
thunk_object_destroy(0xca5757ebc2d0 -> 0xca5757ebc2b0)
usb_drive_object_destroy(0xca5757ebc2b0)
Re: C and its peasant 'ancestors'
Author: Chris M. Thomasson
Date: Tue, 01 Dec 2026 20:40
Date: Tue, 01 Dec 2026 20:40
57 lines
3656 bytes
3656 bytes
On 11/30/2026 1:25 AM, David Brown wrote: > On 30/11/2026 00:48, Chris M. Thomasson wrote: >> On 11/29/2026 3:01 PM, Michael S wrote: >>> On Sun, 29 Nov 2026 22:48:51 -0000 (UTC) >>> cross@spitfire.i.gajendra.net (Dan Cross) wrote: >>> >>>> In article <20261130000723.0000290f@yahoo.com>, >>>> Michael S <already5chosen@yahoo.com> wrote: >>>>> On Sun, 29 Nov 2026 04:22:25 -0000 (UTC) >>>>> cross@spitfire.i.gajendra.net (Dan Cross) wrote: >>>>>> In article <20261128201354.000064be@yahoo.com>, >>>>>> Michael S <already5chosen@yahoo.com> wrote: >>>>>>> On Sat, 28 Nov 2026 12:26:54 -0000 (UTC) >>>>>>> cross@spitfire.i.gajendra.net (Dan Cross) wrote: >>>>>>>> In article >>>>>>>> <11eds8o$2ahsb$2@raubtier-asyl.eternal-september.org>, Bonita >>>>>>>> Montero <Bonita.Montero@gmail.com> wrote: >>>>>>>>> Am 28.11.2026 um 06:50 schrieb Lawrence >>>>>>>>> DĂĆĂ¢Ă¢ââŹĹĄĂÂŹĂ¢ââŹĹžĂ¢Oliveiro: >>>>>>>>>> It *is* strongly-typed, and compiled. >>>>>>>>> >>>>>>>>> Python is weakly typed. >>>>>>>>> Type annotations aren't enforced by the compiler. >>>>>>>> >>>>>>>> Lawrence is an idiot, but he's right about this.  Python >>>>>>>> is _strongly_ typed, but it is not _statically_ typed. >>>>>>> >>>>>>> Weak or strong - it's not very important in practice. >>>>>> >>>>>> You mean static versus dynamic. >>>>> >>>>> No, I meant exactly what I wrote. >>>> >>>> What you wrote was unclear. >>>> >>>>> Python is strongly typed. It is of little practical importance. >>>> >>>> Then you're wrong. Strong typing is _essential_ to avoid >>>> getting garbage results. >>> >>> There is a whole continuum of possibilities between strongly typed and >>> untyped. >>> >>>> Adding 1 to a linked-list is a mistake >>>> that should be caught somehow; whether at runtime (as in a >>>> dynamic) language or at compile-time as in a statically typed >>>> langauge is, as I said, a different axis. >>>> >>>>> Python lacks static checks. It is of higher importance. >>>> >>>> Without strong typing what would it check? >> Are you a fan of duck typing? ;^) > > I find my pet cat types better than my pet duck. > :^D It can be useful, but dangerous.... The cat barks!
Page 4 of 4 ⢠177 total messages
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads