We've talked about adding the title to the filename several times over the years and it seems really valuable. This requires us to compute a "slug" for the title spelling that can be part of the filename. Beyond that, we crossed 7000 recently, and so it seems likely that we will need to add digits sooner rather than later here, so this goes ahead and moves us to 6 digits so we don't have to adjust again for a reasonable length of time. To implement this and ensure we can sustain it going forward this adds a tool to our pre-commit that validates (and corrects if needed) the filename. In order to update everything and keep links working, there are a _lot_ of changes, but the most interesting for direct review are in `proposals/scripts`. Assisted-by: Antigravity with Gemini --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
1.8 KiB
Replace impl fn with override fn
Table of contents
Abstract
This proposal renames the syntax used to mark an overriding definition of a
virtual method from impl fn to override fn to avoid ambiguity.
Problem
The phrase impl fn was introduced to mark overriding virtual functions,
however, it is now ambiguous: besides indicating an overriding virtual function,
it can be parsed as an "impl" declaration when the construct following "impl"
begins with a lambda introduced by "fn".
Background
The original syntax was adopted in proposal #777 to emphasize that implementing interfaces and overriding virtual functions are similar operations.
Proposal
This proposal is to replace the impl fn syntax with override fn for method
overriding in class inheritance.
Note that impl is still a modifier keyword for library and package
declarations (impl library ... and impl package ... respectively). The
former is unambiguous and the latter is easy to disambiguate, so no change is
needed for these two cases.
Rationale
This proposal is focused on the
That code is easy to read, understand, and write
Carbon goal. Changing the keyword from impl to override makes the intent
clearer, resolves syntax ambiguity, and adheres to existing C++ conventions.