Skip to content
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

Feature Proposal: Create function synonyms for long function names #47

Open
Haizlbliek opened this issue Oct 1, 2024 · 0 comments
Open

Comments

@Haizlbliek
Copy link

Replacing long function names with a synonymic variable can be used to save a whole lot of characters if used frequently.

Example

-- 81 tokens
-- 243 chars
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)
printh(1)

This uses a lot of characters, so if you create a variable (p) that stores the function printh, you can save 126 characters at the cost of only 3 tokens.

-- 84 tokens
-- 117 chars
p=printh
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)
p(1)

This would take effect on any focus except Tokens and Tokens & Compressed Size.
It saves a lot of characters and a few compressed size units (idk what to call them).
Only when focusing on tokens do the downsides outweigh the upsides.

It's technically even worth it for functions of length 2 (though there aren't any built-in functions that short), but it's more than worth it for length 3+ functions.

@Haizlbliek Haizlbliek changed the title Feature Proposal: Create function synonyms when character count is high Feature Proposal: Create function synonyms for long function names Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant