Earlier quoted context omitted.
This is something I always disagreed with. In my experience, I rather read a short comment explaining what is the purpose of a block of code, than trying to decipher it. Yes, code "should speak for itself", but reading a comment is almost always faster than reading blocks of code. And then there is also documentation (if you include it in what you define as comment). I much rather go through a website, with a search…
But the purpose is the Why; forced comments tend to tell you What the code does, which is better explained by the code itself. A comment that is incorrect can do a lot of damage, and they tend to get confused about implementation details over time.
OpenAI is good at unminifying code
161–170 of 321 posts
Re: OpenAI is good at unminifying code
#162This post basically says that I don't need to document my code anymore. No more comments, they can be generated automatically. Hurray!
int accountId;
We truly live in the future
Re: OpenAI is good at unminifying code
#163Re: OpenAI is good at unminifying code
#164It is good at unminifying and "minifying" as well. I have been doing the Leetcode thing recently, and even became a subscriber to Leetcode. What I have been doing is I go through the Grind 75 list (Blind 75 successor list), look for the best big O time and space editorial answer, which often has a Java example, and then go to ChatGPT (I subscribe) or Perplexity (don't subscribe to Pro - yet) and say "convert this to…
However, I wonder about this: What will you do in a live interview situation? Will you pull up ChatGPT?
Re: OpenAI is good at unminifying code
#165Earlier quoted context omitted.
This is something I always disagreed with. In my experience, I rather read a short comment explaining what is the purpose of a block of code, than trying to decipher it. Yes, code "should speak for itself", but reading a comment is almost always faster than reading blocks of code. And then there is also documentation (if you include it in what you define as comment). I much rather go through a website, with a search…
It's just a rule of thumb, like anything else. In most code, "why" is the hard part; I see that you are incrementing that account by a penny from out of the blue, but why? When you are in code where "what" is the hard part, like an implementation of a book algorithm or some tricky performance optimization, then by all means comment that. Really all this rule amounts to is // Increment by a penny accountValue += 1 is…
// Parse the filename and remove the extension
let fext_re = Regex::new(r"(.\*)\.(.+)$").unwrap();
let page_cap = fext_re.captures(fname).unwrap();
let page_base_filename = page_cap.get(1).unwrap().as_str();
Is still useful. Instead of having to read the next few line of code, I already know what they are suppose to do and expect.
It makes discovery, later down the line, easier.Re: OpenAI is good at unminifying code
#166Earlier quoted context omitted.
Of course, it is not generalizable! In my experience though, most minifiers do only the following: - Whitespace removal, which is trivially invertible. - Comment removal, which we never expect to recover via unminification. - Renaming to shorter names, which is tedious to track but still mechanical. And most minifiers have little understanding of underlying types anyway, so they are usually very conservative and rare…
I feel you’re downplaying the obfuscatory power of name-mangling. Reversing that (giving everything meaningful names) is surely a difficult problem?
Let me give some concrete example from my old comment [1]. The full code in question was as follows, with only whitespaces added:
function smb(){
var a,b,c,d,e,h,l;
return t(function(m){
a=new aj;
b=document.createElement("ytd-player");
try{
document.body.prepend(b)
}catch(p){
return m.return(4)
}
c=function(){
b.parentElement&&b.parentElement.removeChild(b)
};
0
Many local variables should be easy to reconstruct: b -> player, c -> removePlayer, d -> playerDiv1, e -> playerDiv2, h -> playerVideo, l -> blob (we don't know which blob it is yet though). We still don't know about non-local names including t, aj, lc, Mia and m, but we are reasonably sure that it builds some DOM tree that looks like ``. We can also infer that `removePlayer` would be some sort of a cleanup function, as it gets eventually called in any possible control flow visible here.Given that `a.resolve` is the final function to be executed, even later than `removePlayer`, it will be some sort of "returning" function. You will need some information about how async functions are desugared to fully understand that (and also `m.return`), but such information is not strictly necessary here. In fact, you can safely ignore `lc` and `Mia` because it eventually sets `playerVideo.src` and we are not that interested in the exact contents here. (Actually, you will fall into a rabbit hole if you are going to dissect `Mia`. Better to assume first and verify later.)
And from there you can conclude that this function constructs a certain DOM tree, sets some class after 200 ms, and then "returns" 0 if the video "ticks" or 1 on timeout, giving my initial hypothesis. I then hardened my hypothesis by looking at the blob itself, which turned out to be a 3-second-long placeholder video and fits with the supposed timeout of 5 seconds. If it were something else, then I would look further to see what I might have missed.
Re: OpenAI is good at unminifying code
#167>I apologize, GPT-4, for mistakenly accusing you of making mistakes. I am testing large language models against a ground truth data set we created internally. Quite often when there is a mismatch, I realize the ground truth dataset is wrong, and I feel exactly like the author did.
Re: OpenAI is good at unminifying code
#168Earlier quoted context omitted.
ChatGPT is trained well enough on all things AWS that it can do a decent job translating Python based SDK code to Node and other languages, translate between CloudFormation/Terraform/CDK (in various languages). It does a well at writing simple to medium complexity automation scripts around AWS. If it gets something wrong, I tell it to “verify your answer using the documentation available on the web”
>>ChatGPT is trained well enough on all things AWS It was scary to me how to chatting with GPT or Claude would give me information which was a lot more clear than what I could deduce after hours of reading AWS documentation. Perhaps, the true successor to Google search has arrived. One big drawback of Google was asking questions that can't be converted to a full long conversation. To that end. LLM chat is the ultimat…
It's nothing short of incredible. Each of those tasks would normally have taken me hours and I have working code in actual seconds.
Re: OpenAI is good at unminifying code
#169Earlier quoted context omitted.
I see your point, but I think there's more to it. It's kind of like saying "all humans can do is perceive and produce sound, any other ability is just a side-effect". We might be focusing too much on their mechanism for "perception" and overlooking other capabilities they've developed.
Sure, but that claim wouldn't be true for humans, right? So it's a nonsequiteur. The relevant claim would be: all humans can do is move around in their environments, adapt the world around them through action, observe using adaptive sensory motor systems, grow and adapt their brains and bodies in response to novel and changing environments, abstract sensory motor techniques into symbolic concepts, vocalize this using…
To me, results like the Othello paper make any sort of "stochastic parrot" thinking completely untenable.
Re: OpenAI is good at unminifying code
#170Earlier quoted context omitted.
Better Hoover it up!
All jokes aside, I've never heard anyone call vacuuming hoover. I wonder if that was a older statement?