Skip to content

zig fmt: canonicalize symbol names #166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andrewrk opened this issue Jul 29, 2016 · 1 comment · Fixed by #13343
Closed

zig fmt: canonicalize symbol names #166

andrewrk opened this issue Jul 29, 2016 · 1 comment · Fixed by #13343
Labels
accepted This proposal is planned. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. zig fmt
Milestone

Comments

@andrewrk
Copy link
Member

Currently in Zig, it's legal to do this:

fn foo() {

}
fn bar() {
    @"foo"();
}

Or worse:

fn bar() {
    @"\x66\x6f\x6f"();
}

This is not grep friendly and it goes against One Way To Do Things. It would be nice if code readers could rely on all symbols being represented the same way.

Therefore I propose an error of the form:

error: non-canonical symbol: @"\x66\x6f\x6f". Use `foo` instead.

This also serves the goal of Prioritize Reading Code Over Writing It.

@andrewrk andrewrk added the enhancement Solving this issue will likely involve adding new logic or components to the codebase. label Jul 29, 2016
@andrewrk andrewrk modified the milestone: 0.1.0 Jan 16, 2017
@andrewrk andrewrk added this to the 0.2.0 milestone May 7, 2017
@andrewrk andrewrk added the breaking Implementing this issue could cause existing code to no longer compile or have different behavior. label May 7, 2017
@andrewrk andrewrk modified the milestones: 0.2.0, 0.3.0 Oct 20, 2017
@andrewrk andrewrk modified the milestones: 0.3.0, 0.4.0 Feb 28, 2018
@andrewrk andrewrk modified the milestones: 0.4.0, 0.5.0 Nov 28, 2018
@andrewrk andrewrk added proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. and removed enhancement Solving this issue will likely involve adding new logic or components to the codebase. labels Nov 28, 2018
@andrewrk andrewrk modified the milestones: 0.5.0, 0.6.0 Aug 19, 2019
@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Dec 9, 2019
@andrewrk andrewrk changed the title add error for non-canonical symbol name zig fmt: canonicalize symbol names Oct 9, 2020
@andrewrk andrewrk added accepted This proposal is planned. and removed breaking Implementing this issue could cause existing code to no longer compile or have different behavior. labels Oct 9, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 9, 2020
@andrewrk
Copy link
Member Author

andrewrk commented Oct 9, 2020

Original proposal rejected. Counter proposal accepted: canonicalize symbol names with zig fmt.

@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 May 19, 2021
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 Nov 20, 2021
@andrewrk andrewrk removed this from the 0.10.0 milestone Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This proposal is planned. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. zig fmt
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant