Cpp2 design notes: UFCS, “const”, “unsafe”, and (yes) ABI
Thanks to everyone who has offered bug reports and constructive suggestions for Cpp2 and cppfront. To answer common questions I encounter repeatedly, I’ve started a wiki with “Design notes” about specific aspects of the design to answer why I’ve made them they way they currently are… basic rationale, alternatives considered, in a nutshell. There are … Continue reading Cpp2 design notes: UFCS, “const”, “unsafe”, and (yes) ABI →
Thanks to everyone who has offered bug reports and constructive suggestions for Cpp2 and cppfront.
To answer common questions I encounter repeatedly, I’ve started a wiki with “Design notes” about specific aspects of the design to answer why I’ve made them they way they currently are… basic rationale, alternatives considered, in a nutshell. There are four design notes so far… pasting from the wiki:
- Design note: UFCS Why does UFCS use fallback semantics (prefer a member function)? Doesn’t that mean that adding a member function later could silently change behavior of existing call sites?
- Design note: const objects by default Should objects be
const
? Mostly yes. - Design note: unsafe code Yes, I intend that we should be able to write very-low-level facilities in Cpp2. No, that doesn’t mean a monolithic “unsafe” block… I think we can do better.
- Design note: ABI Cpp2 is ABI-neutral, but its immunity from backward compatibility constraints presents an opportunity for link-level improvements, not just source-level improvements.
The wiki also contains links to related projects. There are two of those so far:
- /modern-cmake/cppfront: A modern CMake (3.23+) build for cppfront, complete with automatic cpp2-to-cpp1 translation. Compatible with
find_package
,add_subdirectory
, andFetchContent
. - /JohelEGP/jegp.cmake_modules/#jegpcpp2: A CMake module to build Cpp2 source files.
Thanks again for the feedback and interest.