carbon-lang icon indicating copy to clipboard operation
carbon-lang copied to clipboard

Update the design docs for functions to reflect the lambdas proposal

Open geoffromer opened this issue 6 months ago • 2 comments

#3848 introduced some changes to the design of named functions, as part of generalizing them to encompass lambda expressions. For example:

  • They can take positional parameters instead of named parameters.
  • They can be defined with => expr; instead of -> ReturnType { body }
  • They can have captures.

Lambda expressions themselves were added to the design documentation in #5300, but docs/design/functions.md and docs/design/README.md should also be updated to reflect the changes to named functions.

geoffromer avatar May 01 '25 00:05 geoffromer

should we move lambdas in table of contents (currently under "Unfinished tales") to functions?

Example:

  • Functions
    • Parameters
    • auto return type
    • Block and statements
    • Lambdas <---- Example
    • Control Flow
      • if and else
      • etc...

This would also mean the short summary for lambdas in the docs/design/README.md should be done too?

IvanDuran02 avatar May 01 '25 05:05 IvanDuran02

That seems like a good idea. I don't think it necessarily needs to be done to resolve this issue, but if it's convenient to do that along the way, great!

geoffromer avatar May 01 '25 23:05 geoffromer