mirror of
https://github.com/jehna/humanify.git
synced 2026-04-27 09:35:58 +03:00
[GH-ISSUE #344] Why are there long underscores before the names in the output code? #67
Labels
No labels
bug
enhancement
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/humanify#67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lissettecarlr on GitHub (Feb 25, 2025).
Original GitHub issue: https://github.com/jehna/humanify/issues/344
Input a segment:
output a segment:
@0xdevalias commented on GitHub (Feb 26, 2025):
I would suspect that there were a lot of name clashes, and this safe rename code is what's doing it:
github.com/jehna/humanify@7b85f9de6c/src/plugins/local-llm-rename/visit-all-identifiers.ts (L42-L54)Some past discussion related to this feature here as well:
Instead of just prefixing with
_each time there is a clash, it might be better to generate some kind of suffix likefoo$1,foo$2, etc; which has also been mentioned in the past:And some other related issues/PRs:
Also.. off the top of my head.. since we're tracking
renamesagainst the entire program, rather than just per scope, it means that if there is a similarly named variable anywhere in the program, it will be disallowed, and thus get an extra_prefix.github.com/jehna/humanify@7b85f9de6c/src/plugins/local-llm-rename/visit-all-identifiers.ts (L20)github.com/jehna/humanify@7b85f9de6c/src/plugins/local-llm-rename/visit-all-identifiers.ts (L51)While this can obviously make it easier to not have to think about scope rules/shadowing while quickly skimming through a file, in cases like this, it clearly makes things worse. This issue is tangentially related to that area of the code:
@lissettecarlr commented on GitHub (Feb 26, 2025):
Thank you for your reply.
I checked the source code and indeed found numerous variables with the same character names. The main issue is that the single-page code is too long, causing the underscores to stack up infinitely.
@0xdevalias commented on GitHub (Feb 26, 2025):
It might be worth leaving this issue open as a reminder that we could improve this based on some of the notes above.
@0xdevalias commented on GitHub (Mar 12, 2025):
Related older issue:
Which is then also tangentially related to this one:
Also, this upstream
webcrackissue/PR may improve this situation somewhat too: