• Little gem found in 1989 Cfront sources.

    From Kaz Kylheku@21:1/5 to All on Wed Feb 14 03:06:00 2024
    In a file "template.h" which is part of the implementation an early version of C++ templates (calling them the "parametrized type facility"), this is found:

    // A Lisp style cons cell to help build lists. The parametrized type facility, // should obviate the need for this type-unsafe nonsense.
    class cons {
    public:
    void *car ;
    cons *cdr ;
    cons (void *pcar, cons *pcdr) { car = pcar ; cdr = pcdr ; } ;
    } ;

    Could 2024 could be the year when it finally obviates, once and for all?

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Rubin@21:1/5 to Kaz Kylheku on Sat Feb 17 18:07:30 2024
    Kaz Kylheku <433-929-6894@kylheku.com> writes:
    Could 2024 could be the year when it finally obviates, once and for all?

    Is something happening with C++ templates that would change how that
    cons works? STL already has List<T> and that is similar to how lists in Haskell and Ocaml work. You usually wouldn't have a list of objects of arbitrary varying type, though you have a limited set that you represent
    as a sum type or a GADT.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeff Barnett@21:1/5 to Paul Rubin on Sat Feb 17 23:12:12 2024
    On 2/17/2024 7:07 PM, Paul Rubin wrote:
    Kaz Kylheku <433-929-6894@kylheku.com> writes:
    Could 2024 could be the year when it finally obviates, once and for all?

    Is something happening with C++ templates that would change how that
    cons works? STL already has List<T> and that is similar to how lists in Haskell and Ocaml work. You usually wouldn't have a list of objects of arbitrary varying type, though you have a limited set that you represent
    as a sum type or a GADT.

    PLIST are very popular and much used in LISP. Even elements are of any
    type where EQ is useful but odd numbered elements are arbitrary. I know
    I'm picking a nit but, what the hell, it's late Saturday and TV sucks.
    --
    Jeff Barnett

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Rubin@21:1/5 to Jeff Barnett on Wed Feb 21 12:55:23 2024
    Jeff Barnett <jbb@notatt.com> writes:
    Haskell and Ocaml work. You usually wouldn't have a list of objects of
    arbitrary varying type,
    PLIST are very popular and much used in LISP.

    Sure, yeah, lists of mixed-type objects are not that unusual in Lisp. I
    had meant in Haskell or Ocaml.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)