From: | Jose Luis Tallon <jltallon(at)adv-solutions(dot)net> |
---|---|
To: | Nico Williams <nico(at)cryptonector(dot)com>, Isaac Morland <isaac(dot)morland(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, Andres Freund <andres(at)anarazel(dot)de> |
Subject: | Re: Violation of principle that plan trees are read-only |
Date: | 2025-05-20 21:24:18 |
Message-ID: | 74303baf-d2de-a39e-3bd7-1546d06d8de6@adv-solutions.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 20/5/25 22:43, Nico Williams wrote:
> [snip]
> What you want is for C to have a type attribute that denotes
> immutability all the way down. `const` doesn't do that. One thing that
> could be done is to write a utility that creates const-all-the-way-down
> clones of given types, but such a tool can't be written as C
> pre-processor macros -- it would have to be a tool that parses the
> actual type definitions, or uses DWARF or similar to from the
> compilation of a file (I've done this latter before, but this weds you
> to compilers that output DWARF, which MSVC doesn't, for example).
>
> Really, the C committee ought to add this at some point, darn it. It
> would be the opposite of Rust's &mut.
Like C++'s const specifier, specially const references to objects? This
is actually natively compatible with C code, "just" by throwing extern
"C" around.....
https://en.cppreference.com/w/cpp/language/cv
(most of Postgres' code is already "Object-oriented in C" in my view...)
The fact that the C++ compiler is usually able to optimize deeper/better
than a C one due to aggresive inlining+global optimization and inferred
"strict"ness doesn't hurt either :)
My €.02. HTH.
/ J.L.
--
Parkinson's Law: Work expands to fill the time alloted to it.
From | Date | Subject | |
---|---|---|---|
Next Message | Aidar Imamov | 2025-05-20 21:32:16 | Re: Hash table scans outside transactions |
Previous Message | Masahiko Sawada | 2025-05-20 21:23:11 | Re: Assert("vacrel->eager_scan_remaining_successes > 0") |