🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

162 total messages Page 4 of 4 Started by Lynn McGuire Thu, 05 Nov 2026 23:42
Page 4 of 4 • 162 total messages
Re: Polymorphism (Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthesis for proper ...
#1797
Author: Ross Finlayson
Date: Mon, 23 Nov 2026 00:17
78 lines
5566 bytes
On 11/22/2026 12:12 PM, Tristan Wibberley wrote:
> On 19/11/2026 22:36, Ross Finlayson wrote:
>
>> polymorphic types, for example any of various accounts after vtables yet
>> anyways otherwise according to a block of functions in C, so,
>> function-overloading,
>
> I suppose that concept name would be interpreted for C as it is for C++
> due to the close relationship between the two (especially with your
> mention of vtables which has strong connotations of what people call
> "polymorphic types" vis-a-vis C++).
>
> However, that's not the only referent and there's a formal CS/mathsy one
> that admits no runtime variation. The procedure who's argument type is a
> so-called "polymorphic type" could be seen to be a polymorphic procedure
> but that seems to me to be more properly what a procedure template
> describes.
>
> How would readers of the groups characterise C++ so-called "runtime
> polymorphism" and that which C programmers would and have often done
> with vtables (GObject, for example), formally?
>
>

Hello. Tristan, this was sort of being bandied-about in the
"Inversion-of-control and dependency-injection in C", about
accounts like there's how vtables do it, there's how usually
enough it's just a context-pointer of function-pointers,
which is much alike if less involved than the composition
of vtables, then there's how "Go" and "Rust" do it, which
is a bit less involved, there are "tagged unions" or "tagged structs"
and "kinded unions" for variants the type (the variant type,
eg, since COM or where people learn about these things),
about co-variant return types, and function overloading,
in C, to attain to the features that C++ of course already
famously supports in the language, in a particularly opinionated way.


There are a variety and number of ways to make for "polymorphism"
as after "encapsulation", yet, "polymorphim" refers specifically
to "polymorphism of types", vis-a-vis, a "polymorphic type", basically
about what's considered the needful for C is the auto keyword,
since C already has types. Then, the _Generic construct, which
is in both C and C++, and has various accounts which can be made
where it's on par with templates, though of course with much less
general flexibility or support, there's that the type of whatever "auto"
is in the lvalue can result carrying the "controlling-expression" in the
_Generic expression to the type-matching to using the value, vis-a-vis
"holder" or "variant" which has got no otherwise type itself, except
insofar as that's a placeholder of "vanishing/phantom" types, that yet
agreeably the tagged-union or kinded-union has members that can make for
distinct types of the tags under controlling-expression, then about this
overloading/underloading sort of account about fixed-size array types in
C (i.e., that are line, page, and huge-aligned memory buffers, or,
short, 32, long, or max name char array.


This targeting C11/C++11, then there's "__auto__" in GCC/Clang which
is alike C23's "auto", the lvalue of which can be the
controlling-expression in a _Generic construct resulting maintaining the
type on
through about parameterizing the type, then about "polymorphism in
types" beyond "polymorphic types", the controlling-expression in the
_Generic construct can be as of according to a union type after
"offsetof" a given field named eg "t" for tagged or "k" for kinded,
these being about the few moving parts in C through which "type"
definition or values resulting expressions on identifiers by duck-typing
exist, about getting a typed representation at compile-time, vis-a-vis,
run-time polymorphism after variant types,
where the goal of "polymorphism in types" is compile-time polymorphism.


Thanks for writing, good luck with that.




Re: Polymorphism (Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthesis for proper ...
#1799
Author: Tristan Wibberley
Date: Mon, 23 Nov 2026 06:03
51 lines
4187 bytes
On 23/11/2026 00:17, Ross Finlayson wrote:
> On 11/22/2026 12:12 PM, Tristan Wibberley wrote:
>> On 19/11/2026 22:36, Ross Finlayson wrote:
>>
>>> polymorphic types, for example any of various accounts after vtables yet
>>> anyways otherwise according to a block of functions in C, so,
>>> function-overloading,
>>
>> I suppose that concept name would be interpreted for C as it is for C++
>> due to the close relationship between the two (especially with your
>> mention of vtables which has strong connotations of what people call
>> "polymorphic types" vis-a-vis C++).
>>
>> However, that's not the only referent and there's a formal CS/mathsy one
>> that admits no runtime variation. 

...
>> How would readers of the groups characterise C++ so-called "runtime
>> polymorphism" and that which C programmers would and have often done
>> with vtables (GObject, for example), formally?


> There are a variety and number of ways to make for "polymorphism"
> as after "encapsulation", yet, "polymorphim" refers specifically
> to "polymorphism of types", vis-a-vis, a "polymorphic type"
Well, the way I see the term being used in CS is not really that,
although perhaps the full treatment including dependent types yields
something that includes runtime polymorphism as we call it in C++. The
concept in CS is early enough that what we use the name for in C++ might
be derived from the CS term (early 1970s at least).

But the "runtime" part would come entirely from the dependent types
combined with polymorphic functions, not from CS polymorphic types if
it's even correct to call them that instead of parameterised types.

I value some precise distinctivising contentions in this area vis-a-vis
C and C++ applications of the concepts because I hope to be able to
precisely taxonomise some of the relevant techniques used in C and C++.

-- 
Tristan Wibberley

The message body is Copyright (C) 2026 Tristan Wibberley except
citations and quotations noted. All Rights Reserved except that you may,
of course, cite it academically giving credit to me, distribute it
verbatim as part of a usenet system or its archives, and use it to
promote my greatness and general superiority without misrepresentation
of my opinions other than my opinion of my greatness and general
superiority which you _may_ misrepresent. You definitely MAY NOT train
any production AI system with it but you may train experimental AI that
will only be used for evaluation of the AI methods it implements.
Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthesis for proper evaluation?)
#1800
Author: Tristan Wibberley
Date: Mon, 23 Nov 2026 07:33
20 lines
2451 bytes
On 22/11/2026 23:48, Ross Finlayson wrote:

> Also, "Dunning-Kruger" should be invoked very sparingly.


Hands up who thinks they understand the Dunning-Kruger effect?


-- 
Tristan Wibberley

The message body is Copyright (C) 2026 Tristan Wibberley except
citations and quotations noted. All Rights Reserved except that you may,
of course, cite it academically giving credit to me, distribute it
verbatim as part of a usenet system or its archives, and use it to
promote my greatness and general superiority without misrepresentation
of my opinions other than my opinion of my greatness and general
superiority which you _may_ misrepresent. You definitely MAY NOT train
any production AI system with it but you may train experimental AI that
will only be used for evaluation of the AI methods it implements.
Yet another digression (was Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthesis f...
#1807
Author: Janis Papanagnou
Date: Mon, 23 Nov 2026 10:06
43 lines
3969 bytes
On 2026-11-22 18:04, Ross Finlayson wrote:
> 
> [...] Then,
> for example there's "blank line at the end of a file or no blank line",

(Note that your wording is expressing a shifted perspective.)

> for example Java-style has "no trailing line", here it's that
> the files always have a trailing empty line, then that for
> accounts like "cat all the files" that they're not ellided.

I've never heard about "blank line at the end of a file". I
suppose what you mean here is the effect that may be described:
(a) every line should be terminated by a newline character,
(b) some editors seem to display that proper line termination
     (for the last data line) as an empty line on their GUI.
Note that this is an issue some editors introduce by their way
of _representing_ a text, and not a property of the text data.

A _file_ containing data (with line terminators '\n')
   line one\n
   line two\n
   ...
   last line\n
has no "empty last line" (whatever your editor displays).

The consequence of editors displaying a spurious empty line
when all lines (including the last) are consistently terminated
with a newline character is obviously that folks using such
editors and have a tendency to consider a [spurious appearing]
"empty line" as unnecessary ballast (and omit line termination)
may run into problems like the 'cat' case you hinted on.

Folks are free to use more sophisticated editors, or configure
the ("misbehaving") editors to behave properly (if they allow
that), or just live with the consequences (and disseminate that
data problem further into the development team).

Janis

> 
> [...]
Re: Yet another digression (was Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthes...
#1829
Author: James Kuyper
Date: Tue, 24 Nov 2026 04:15
28 lines
3375 bytes
On 2026-11-23 05:06, Janis Papanagnou wrote:
> On 2026-11-22 18:04, Ross Finlayson wrote:
>>
>> [...] Then,
>> for example there's "blank line at the end of a file or no blank line",
> 
> (Note that your wording is expressing a shifted perspective.)
> 
>> for example Java-style has "no trailing line", here it's that
>> the files always have a trailing empty line, then that for
>> accounts like "cat all the files" that they're not ellided.
> 
> I've never heard about "blank line at the end of a file".

I no longer see Ross's messages directly, only what's quoted in other
people's responses.

Could he be referring to what the C standard says about text streams:

"Whether the last line requires a terminating new-line character is
implementation-defined." (7.24.2p2 n3998.pdf)

I wouldn't describe that as "blank line or no blank line", but I could
imagine it being misunderstood that way.

The C++ standard defines the behavior of many fundamental <iostream>
functions in terms of the C standard library's routines, so I suspect
that this also applies to C++.
Re: Yet another digression (was Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthes...
#1830
Author: Janis Papanagnou
Date: Tue, 24 Nov 2026 06:40
60 lines
4722 bytes
On 2026-11-24 05:15, James Kuyper wrote:
> On 2026-11-23 05:06, Janis Papanagnou wrote:
>> On 2026-11-22 18:04, Ross Finlayson wrote:
>>>
>>> [...] Then,
>>> for example there's "blank line at the end of a file or no blank line",
>>
>> (Note that your wording is expressing a shifted perspective.)
>>
>>> for example Java-style has "no trailing line", here it's that
>>> the files always have a trailing empty line, then that for
>>> accounts like "cat all the files" that they're not ellided.
>>
>> I've never heard about "blank line at the end of a file".
> 
> I no longer see Ross's messages directly, only what's quoted in other
> people's responses.
> 
> Could he be referring to what the C standard says about text streams:

As what he writes appears often a bit convoluted it's not clear to
me whether he was implicitly referring to the C-standard. There
was no explicit reference to the C-standard (as far as I recall).

Given the wording and context as presented (Tabs vs. Spaces, long
lines, and meta-rambling etc.) it appeared more to be a statement
about editors; data representation, files, the editors' GUIs. All
somehow mixed in one (arguable; at least imprecise) statement. If
we know (and spell out) these differences readers may get aware of
the potential problems and act accordingly (which was my point).

> 
> "Whether the last line requires a terminating new-line character is
> implementation-defined." (7.24.2p2 n3998.pdf)

Working in POSIX environments, though, we have the certainty and we
need not rely on the (yet another) uncertainty that the C-standard
exposes here.

(Personally I'm not much concerned as I'm always creating terminated
lines in text-files. I'm also using an editor where the editor cares
about detecting and creating correct representations in files, and
which facilitates me to control that in (very rare) cases where I'd
need it.)

> 
> I wouldn't describe that as "blank line or no blank line", but I could
> imagine it being misunderstood that way.

Given the representations of his thoughts it's easy to misunderstand
his intention. Any answers will have to consider the thereby induced
uncertainty.

> 
> The C++ standard defines the behavior of many fundamental <iostream>
> functions in terms of the C standard library's routines, so I suspect
> that this also applies to C++.

Janis
Re: Yet another digression (was Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthes...
#1832
Author: Ross Finlayson
Date: Tue, 24 Nov 2026 16:37
62 lines
5075 bytes
On 11/23/2026 08:15 PM, James Kuyper wrote:
> On 2026-11-23 05:06, Janis Papanagnou wrote:
>> On 2026-11-22 18:04, Ross Finlayson wrote:
>>>
>>> [...] Then,
>>> for example there's "blank line at the end of a file or no blank line",
>>
>> (Note that your wording is expressing a shifted perspective.)
>>
>>> for example Java-style has "no trailing line", here it's that
>>> the files always have a trailing empty line, then that for
>>> accounts like "cat all the files" that they're not ellided.
>>
>> I've never heard about "blank line at the end of a file".
>
> I no longer see Ross's messages directly, only what's quoted in other
> people's responses.
>
> Could he be referring to what the C standard says about text streams:
>
> "Whether the last line requires a terminating new-line character is
> implementation-defined." (7.24.2p2 n3998.pdf)
>
> I wouldn't describe that as "blank line or no blank line", but I could
> imagine it being misunderstood that way.
>
> The C++ standard defines the behavior of many fundamental <iostream>
> functions in terms of the C standard library's routines, so I suspect
> that this also applies to C++.
>


I know what I meant, it doesn't take a generous reading to see
that's what's _relevant_ as an example.


The generous vis-a-vis the in-generous reading has that usual
accounts like for "Grice" again or "effective communication",
here has that having a "blank line" at the end of a compilation
unit's sources, is usually considered a reasonable thing, vis-a-vis,
for example, using line-oriented data and where either line-endings
or end-of-file are record-separators, and _not_ having blank lines,
i.e., there are settings where the last character in the file
being a newline (i.e., resulting a "blank line", in the generous
reading, for a line-reader that interprets either line-endings
or end-of-file as record-separators and, well, end-of-file),
is allowed, and settings where it ain't, that then in source files,
about which various opinionated pretty-printers eventually have
an option someone will tweak (and, generally it's a rule that
"tweakers are un-reliable"), finding a chance to save one character-set
character-set-encoding language's/system's newline or line-ending,
like people who can't stand semi-colons as statement-endings,
then has that people who omit the Oxford, standard, Harvard,
serial comma: are considered slights to the language.



I'm not dis-interested your opinion, haven't much heard of it.
Perhaps you have subtler influences than I'd otherwise infer.


Re: Yet another digression (was Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthes...
#1833
Author: Keith Thompson
Date: Wed, 25 Nov 2026 00:50
49 lines
4117 bytes
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> On 2026-11-24 05:15, James Kuyper wrote:
[...]
>> "Whether the last line requires a terminating new-line character is
>> implementation-defined." (7.24.2p2 n3998.pdf)
>
> Working in POSIX environments, though, we have the certainty and we
> need not rely on the (yet another) uncertainty that the C-standard
> exposes here.
>
> (Personally I'm not much concerned as I'm always creating terminated
> lines in text-files. I'm also using an editor where the editor cares
> about detecting and creating correct representations in files, and
> which facilitates me to control that in (very rare) cases where I'd
> need it.)
[...]

Here's what POSIX says.

https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html

    3.185 Line
    A sequence of zero or more non-<newline> characters plus a
    terminating <newline> character.

    3.387 Text File
    A file that contains characters organized into zero or more
    lines. The lines do not contain NUL characters and none can
    exceed {LINE_MAX} bytes in length, including the <newline>
    character. Although POSIX.1-2024 does not distinguish between
    text files and binary files (see the ISO C standard), many
    utilities only produce predictable or meaningful output when
    operating on text files. The standard utilities that have such
    restrictions always specify "text files" in their STDIN or
    INPUT FILES sections.

So as far as C is concerned, a non-empty file not ending in a newline
may or may not be a text file, but in POSIX it is not.  And yes,
many tools will, at least by default, ensure that a created or
updated non-empty text file will end with a newline character.

But there are text-like files that don't end in a newline character
(or that have lines exceeding LINE_MAX bytes), and I expect the
tools I use to deal with such files reasonably, even if POSIX
does't require it.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Re: Yet another digression (was Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthes...
#1834
Author: Janis Papanagnou
Date: Wed, 25 Nov 2026 08:59
53 lines
4240 bytes
On 2026-11-25 01:50, Keith Thompson wrote:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>> On 2026-11-24 05:15, James Kuyper wrote:
> [...]
>>> "Whether the last line requires a terminating new-line character is
>>> implementation-defined." (7.24.2p2 n3998.pdf)
>>
>> Working in POSIX environments, though, we have the certainty and we
>> need not rely on the (yet another) uncertainty that the C-standard
>> exposes here.
>>
>> (Personally I'm not much concerned as I'm always creating terminated
>> lines in text-files. I'm also using an editor where the editor cares
>> about detecting and creating correct representations in files, and
>> which facilitates me to control that in (very rare) cases where I'd
>> need it.)
> [...]
> 
> Here's what POSIX says.
> [snip]

Yes, that's what I was referring to.

> 
> So as far as C is concerned, a non-empty file not ending in a newline
> may or may not be a text file, but in POSIX it is not.  And yes,
> many tools will, at least by default, ensure that a created or
> updated non-empty text file will end with a newline character.
> 
> But there are text-like files that don't end in a newline character

(There are text files that don't have CRs, NLs, or CR-NL at all!
Have a look at fixed record files on mainframes. And then there's
also occasionally been "end-of-file characters" on some systems.)

You may introduce, beside [POSIX] text-file and [non-text] binary
file, a third category "text-like" files, but that doesn't add
anything but confusion about what those files characterize beyond
the two categories given and is at best suitable to "explain" any
deviation from the terms that abstain from "like" descriptions.

> (or that have lines exceeding LINE_MAX bytes), and I expect the
> tools I use to deal with such files reasonably, even if POSIX
> does't require it.

If you're operating only with tools in an own ecosystem you will
likely not observe any problems. Problems arise if your data has
to be processed with different tools (and also across different
platforms).

HTH.

Janis
Re: Yet another digression (was Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthes...
#1835
Author: Tristan Wibberley
Date: Wed, 25 Nov 2026 17:43
64 lines
4443 bytes
On 25/11/2026 00:50, Keith Thompson wrote:
> Here's what POSIX says.
> 
> https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html
> 
>     3.185 Line
>     A sequence of zero or more non-<newline> characters plus a
>     terminating <newline> character.
> 
>     3.387 Text File
>     A file that contains characters organized into zero or more
...


> 
> But there are text-like files that don't end in a newline character
> (or that have lines exceeding LINE_MAX bytes), and I expect the
> tools I use to deal with such files reasonably, even if POSIX
> does't require it.
> 

Interestingly 'file(1)' here doesn't describe the largest text file as a
text file even with -k, but it would be useful to recognise and report
it as such.

$ cpp -include limits.h -P <<<LINE_MAX
2048
$ wc -l *file
   1 bigtextfile
   1 toobigfile
   2 total
$ wc -c *file
2048 bigtextfile
2049 toobigfile
4097 total
$ xxd bigtextfile | tail -n2
000007e0: 6161 6161 6161 6161 6161 6161 6161 6161  aaaaaaaaaaaaaaaa
000007f0: 6161 6161 6161 6161 6161 6161 6161 610a  aaaaaaaaaaaaaaa.
$ xxd toobigfile | tail -n2
000007f0: 6161 6161 6161 6161 6161 6161 6161 6161  aaaaaaaaaaaaaaaa
00000800: 0a                                       .
$ file -k *file
bigtextfile: ASCII text, with very long lines (2047)
toobigfile:  ASCII text, with very long lines (2048)

Note I read the specification as LINE_MAX bytes including the newline
character.

Interestingly the spec says "bytes" not "characters". I wonder if it is
using the age-old definition of "byte" being the size of a character (as
in C) or the modern popular one of "octet".

-- 
Tristan Wibberley

The message body is Copyright (C) 2026 Tristan Wibberley except
citations and quotations noted. All Rights Reserved except that you may,
of course, cite it academically giving credit to me, distribute it
verbatim as part of a usenet system or its archives, and use it to
promote my greatness and general superiority without misrepresentation
of my opinions other than my opinion of my greatness and general
superiority which you _may_ misrepresent. You definitely MAY NOT train
any production AI system with it but you may train experimental AI that
will only be used for evaluation of the AI methods it implements.
Re: Yet another digression (was Re: [meta] O tempora, o mores! (was Re: does an expression in a logical statement need parenthes...
#1836
Author: Kaz Kylheku
Date: Wed, 25 Nov 2026 18:44
19 lines
2790 bytes
On 2026-11-25, Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk> wrote:
> Note I read the specification as LINE_MAX bytes including the newline
> character.
>
> Interestingly the spec says "bytes" not "characters". I wonder if it is
> using the age-old definition of "byte" being the size of a character (as
> in C) or the modern popular one of "octet".

LINE_MAX has to be in bytes probably because it's connected to the idea
of being able to define a buffer large enough to hold a line that is
within the LINE_MAX limit.

If LINE_MAX were given in characters, then you have to think about the
worst case actual buffer size in a given multi-byte encoding.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
Page 4 of 4 • 162 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