• Polymorphism (Re: [meta] O tempora, o mores! (was Re: does anexpression in a logical statement need parenthesis for proper evaluation?))

    From Tristan Wibberley@tristan.wibberley+netnews2@alumni.manchester.ac.uk to comp.lang.c++,comp.lang.c on Sun Nov 22 20:12:06 2026
    From Newsgroup: comp.lang.c

    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?
    --
    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.
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c++,comp.lang.c on Sun Nov 22 16:17:06 2026
    From Newsgroup: comp.lang.c

    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.





    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From Tristan Wibberley@tristan.wibberley+netnews2@alumni.manchester.ac.uk to comp.lang.c++,comp.lang.c on Mon Nov 23 06:03:56 2026
    From Newsgroup: comp.lang.c

    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.
    --- Synchronet 3.21e-Linux NewsLink 1.2