Skip to content

Rethink how names are given to compiler-generated closures #12366

Open
@dsyme

Description

@dsyme

The heuristic used to name compiler-generated closures like foo@376 and clo43@53 is weak. In general the compiler tries to use a related name, e.g. the let identifier being bound, plus the source line number. The source line number seems to be useful, though we could perhaps use @line365 or similar.

The main problem appears to be with the name portion. I need to collect specific micro samples but some things I've noticed are

  • Unnecessary use of the backup name clo
  • Sometimes other compiler-generated names are used as the basis for the name. In debug code I've even seen closure names like Pipe input at line 63@53 recently after the addition of pipeline debugging and I think some are appearing in our codegen tests for queries

Anyway, we can surely have a better heuristic where useful names are always given.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-CodeGenIlxGen, ilwrite and things at the backendFeature ImprovementNeeds-designTheme-Simple-F#A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language.

    Type

    No type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions