3 ms·
>> I didn't want the tool to be language specific or run into unsavory words Good thoughts. However, "beedip" is foreign to everyone, whereas if you pick a lan
by nathan_long 13y ago
>> I didn't want the tool to be language specific or run into unsavory words
Good thoughts. However, "beedip" is foreign to everyone, whereas if you pick a language, it's at least native to some people.
Also, you could have maybe 50 known inoffensive words; there probably aren't more than that many unique variables in a scope. Things like "hat" and "bread".
- billyhoffman 13y agoWhy don't you prefix variables based on their usage in the code? function(a,b,c) -> function(arg1_cat, arg2_tree, arg3_carrot) for(i=0; i< 10; i++) -> for(counter1=0; counter1 < 10; counter1++) var a -> var global_pants; You could do this reasonably well with regular expressions/find+replace. To be more sophisticated you would use a a tokenizer/parser and rename based on the identifiers location in the AST nodes. I did something similar a few years ago for a commercial product that included a JavaScript beautifier and our customers loved it.
- joshklein 13y agoOr perhaps a consistent "namespace", e.g. with a standard prefix prepended to a simple noun.