News for hackers. Stuff that matters.
Re:GitHub's language detection is broken by skywhopper on Friday March 14, 2014 @07:32AM (#7398071)
It's just a design error in the original implementation where linguist assumes that the "primary_extension" for any particular language will be unique among all primary_extensions. Obviously that was a mistake, but that's where we are. The comment that set people off was perhaps poorly worded, but it was an honest suggestion to work around the design bug.
Re:GitHub's language detection is broken by moron4hire on Friday March 14, 2014 @08:35AM (#7398322)
A better suggestion: fix the defect. Just delete primary_extension. At best, it does nothing that the extensions array can't do, as it doesn't appear at first glance that any check to primary_extension does not also include a check to extensions.

At worst, it is confusing to implementers and requires chicanery to work around... which is exactly the case we're in. We're in the worst case scenario for this bit of code, and there is no upside to its best-case scenario. Just delete the code.

Re:GitHub's language detection is broken by DangerousPie on Friday March 14, 2014 @08:59AM (#7398411)
I bet it's not as easy as "just delete the code". They will probably have to do quite a bit of refactoring to remove this, followed by a probably even larger amount of testing.

Long-term this is probably the right solution, but why go through all this trouble right now if there is a simple workaround? It seems like the only problem right now is a few people's pride.

Re:GitHub's language detection is broken by moron4hire on Friday March 14, 2014 @09:17AM (#7398491)
Of course it's not that easy. They don't have a compiler with a static checker to show them all the places the field was used :P
Re:GitHub's language detection is broken by Allan_Smithee on Friday March 14, 2014 @09:17AM (#7398492)
Re:GitHub's language detection is broken by DangerousPie on Friday March 14, 2014 @10:13AM (#7398815)
If I'm reading this right all this does is define the first extension as the primary extension, which still has to be unique. So they would still have to use a different extension as the first one in the list, it just wouldn't be called "primary" anymore. How would this help?
Re:GitHub's language detection is broken by nox_ on Friday March 14, 2014 @12:05PM (#7399727)
There is no unicity check anymore; I just kept the first one special because some private code at GitHub seems to rely on the primary_extension property for the Gist editor. As I can't hack this (it is private), I can't remove it entirely.
Re:GitHub's language detection is broken by aeontech on Friday March 14, 2014 @11:46AM (#7399582)
There's no more requirement for it to be unique as far as I can see.