Changeset 43911a0


Ignore:
Timestamp:
Nov 13, 2025, 12:40:21 PM (3 hours ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Parents:
b94579a
Message:

Add issues with autogen removal: hiding too eagerly and not acting inspectably

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/proposals/autogen.md

    rb94579a r43911a0  
    100100The main reason to manually remove functions is to enforce a behaviour based interface for a type, as opposed to a data based one. To enforce that new interface, this would have to interact with visibility.
    101101
     102### Automatic Remove Hides Everything
     103As soon as you declare a custom constructor, _all_ autogenerated constructors become inaccessible. Often, this behaviour is good, and it agrees with C++. But the desire dual to "manually remove" exists: "manually keep." Furthermore, there is a use case for invoking an automatically provided constructor as a helper, when implementing a custom constructor.
     104
     105        struct S {
     106            int i;
     107            int & j;
     108        };
     109        void ?{}( S & s, int & w ) {
     110            // Unique best alternative includes deleted identifier in:
     111            s{ 3, w };
     112            // intended meaning / workaround:
     113            // s.i = 3; &s.j = &w;
     114        }
     115
     116This use case should be considered also, along with visibility. A private helper constructor should be usable in the implementation of a public value-add constructor. The private helper being an autogen is one such arrangement.
     117
     118Users should have the option to adopt the idiom: All constructors funnel into the most private, all-member constructor.
     119
     120### Removed Functions Linger
     121Even if a function is made CFA-uncallable, it still shows in the emitted C code (`cfa -CFA`). An uncallable function shows identically to a callable function, with no indication of, "This declaration has been deleted," or, "Here is a redaction of X." This quirk reduces the utility of inspecting -CFA to answer, "What constructors would be available to me?" or, "What's the net effect of the constructor declarations and deletions that I've given?"
     122
    102123## Other Problems & Requested Features
    103124
Note: See TracChangeset for help on using the changeset viewer.