Live data from Hacker News

How I fixed a bug in Atom

davidvgalbraith.com

11–20 of 189 posts

Re: How I fixed a bug in Atom

#11
I got to the bottom and couldn't believe that the solution chosen was to modify the regexp instead of use a for loop. He did such a great job explaining that the code is really just trying to count the number of parentheses or braces to see if they're imbalanced, that it felt the next step was "so I wrote a really simple set of loops that is fast enough on short strings and way less crazy otherwise".

Re: How I fixed a bug in Atom

#12
post #8

"How I fixed a bug in Atom that affected almost no one, and then spent quite a lot of time writing an article about it, then wrote a title that attempted to give me more credit than I deserved" .. which is his main pass time if you see his other posts, rather than spending his effort on fixing bugs that actually affect a lot of people. I am sorry but I don't really appreciate it and have trouble getting over the misr…

Wow, talk about "haters gonna hate". This dude went into great detail about debugging the issue, which is very interesting. Your negativity isn't really welcome here.

Re: How I fixed a bug in Atom

#13
post #8

"How I fixed a bug in Atom that affected almost no one, and then spent quite a lot of time writing an article about it, then wrote a title that attempted to give me more credit than I deserved" .. which is his main pass time if you see his other posts, rather than spending his effort on fixing bugs that actually affect a lot of people. I am sorry but I don't really appreciate it and have trouble getting over the misr…

Sure the title is a bit sensationalist, but there was a legitimate issue to fix and he did fix it.

Plus, it is a good write up that explains the problem, solution, and the steps taken well.

It would be a shame to see others put off from fixing bugs, and posting commentary on the solution, in open source software for fear of being put down.

Re: How I fixed a bug in Atom

#15
post #13
post #8

"How I fixed a bug in Atom that affected almost no one, and then spent quite a lot of time writing an article about it, then wrote a title that attempted to give me more credit than I deserved" .. which is his main pass time if you see his other posts, rather than spending his effort on fixing bugs that actually affect a lot of people. I am sorry but I don't really appreciate it and have trouble getting over the misr…

Sure the title is a bit sensationalist, but there was a legitimate issue to fix and he did fix it. Plus, it is a good write up that explains the problem, solution, and the steps taken well. It would be a shame to see others put off from fixing bugs, and posting commentary on the solution, in open source software for fear of being put down.

Others should be put off from taking more credit than due in the title of their posts and from taking on bugs that aren't important just for that purpose.

Re: How I fixed a bug in Atom

#16
post #12
post #8

"How I fixed a bug in Atom that affected almost no one, and then spent quite a lot of time writing an article about it, then wrote a title that attempted to give me more credit than I deserved" .. which is his main pass time if you see his other posts, rather than spending his effort on fixing bugs that actually affect a lot of people. I am sorry but I don't really appreciate it and have trouble getting over the misr…

Wow, talk about "haters gonna hate". This dude went into great detail about debugging the issue, which is very interesting. Your negativity isn't really welcome here.

Its interesting, but you missed my point.

Re: How I fixed a bug in Atom

#17
post #11

I got to the bottom and couldn't believe that the solution chosen was to modify the regexp instead of use a for loop. He did such a great job explaining that the code is really just trying to count the number of parentheses or braces to see if they're imbalanced, that it felt the next step was "so I wrote a really simple set of loops that is fast enough on short strings and way less crazy otherwise".

Same here. Also, I don't use Atom, but looking at the expression I'm pretty sure it fails to account for strings with parentheses. The way the matching is done, it looks like it will happily count:

    func("some call :)")
as extra closing paren. (regex101 agrees)

Re: How I fixed a bug in Atom

#18
post #10

First of all, this is why people should stop adding stupid features to regular expressions. A sane regular expression implementation has no pathological cases. DFA generation can be done in O(n^2) from memory (in the absolute worst case O(n) is average), and matching can't be worse than O(m) or similar (n is the size of the regex and m the size of the string). When you add features like back references and recursive…

I don't always want to spend insane amounts of time writing full AST parsers. Sometimes it is a lot easier to write a simple, hacky, throwaway regex. It's a bit much to claim that backtracking regular expressions, a very useful tool sometimes, should never ever be used and everybody should waste loads of time writing careful code even in situations where it isn't required.

The problem is not the tool. The problem is using the tool for the wrong job - although who knows, maybe if they didn't just chuck out a quick hacky implementation, then atom simply wouldn't have the feature at all - in which case it is a trade-off between having the feature at all and an evidently tiny corner case bug that was easily fixed by someone who isn't even a regular developer of the project.

So I don't see the reason to be outraged or judgemental here.

Re: How I fixed a bug in Atom

#19
post #8

"How I fixed a bug in Atom that affected almost no one, and then spent quite a lot of time writing an article about it, then wrote a title that attempted to give me more credit than I deserved" .. which is his main pass time if you see his other posts, rather than spending his effort on fixing bugs that actually affect a lot of people. I am sorry but I don't really appreciate it and have trouble getting over the misr…

I've never written any Go and I don't use Atom. I also found the article quite interesting. Do we really need a comment on every HN post asking why this is written or created or upvoted?

Re: How I fixed a bug in Atom

#20
post #10

First of all, this is why people should stop adding stupid features to regular expressions. A sane regular expression implementation has no pathological cases. DFA generation can be done in O(n^2) from memory (in the absolute worst case O(n) is average), and matching can't be worse than O(m) or similar (n is the size of the regex and m the size of the string). When you add features like back references and recursive…

> The conversion from DFA to NFA [...]

I believe you mean NFA to DFA.

> [...] would require O(n^2) in that case

I believe you mean O(2^n). https://en.wikipedia.org/wiki/Powerset_construction#Complexi...

Post reply on HN