Strategy for inventing fresh names
- Dominant language
- Standard ML
- Stars
- 44
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Currently, we use an unusual [strategy](https://github.com/CakeML/pure/blob/24dcf0a/compiler/backend/passes/var_setScript.sml#L32-L51) for inventing fresh names: we append sequential numbers to a base name in the hope we produce something fresh, and if we fail we simply create a name longer than any we know. This is partly to ensure the definition is translatable: we can't require `map_ok` to hold of the set of known variable names.
An [alternative approach](https://github.com/CakeML/pure/blob/37684e6/compiler/backend/passes/pure_freshenScript.sml#L62-L95) does not require `map_ok`, as long as it can override the comparison function used in the map. This issue is about fleshing out this approach to produce nicer variable names, getting it translated, and replacing the existing unusual approach.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing compiler/backend/passes/var_setScript.sml#L32-L51 with compiler/backend/passes/pure_freshenScript.sml#L62-L95. Read how the alternative handles comparison and translation, then determine how to produce nicer fresh names without the existing map_ok requirement. Done means the approach is fleshed out, translated, and replaces the current strategy.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100