Live data from Hacker News

Search: .lenght - Github

github.com

31–40 of 106 posts

Re: Search: .lenght - Github

#31
I thought this is actually interesting but I would like to know if >4k misspellings is a lot or not. Here is one way to do it:

    LANGUAGE #LENGHT #LENGTH = #LENGHT/#LENGTH  
    JavaScript 4252 2907459 = 0.0015
    C 18981 2902857 = 0.0065
    Java 7706 2348900 = 0.0033
    Ruby 10789 1690604 = 0.0064
    C++ 9458 1315552 = 0.0072
    PHP 3116 1167924 = 0.0027
    C# 1352 937647 = 0.0014
    Python 3662 737292 = 0.0050
    Ruby 1232 380484 = 0.0032
    Perl 1239 258892 = 0.0048
    Objective-C 679 238051 = 0.0029
P.S. There is something wrong with Github's language breakdown algorithm, sometimes it shows same language twice with a different number of hits.

Re: Search: .lenght - Github

#33

I remember seeing a Github bot a couple weeks ago that strips out whitespace and adds a .gitignore file to a repo (I also remember this really rubbing some people the wrong way). This search indicates that it would probably be useful to have a linter bot running on Github for all the popular languages. It would find syntax errors, common mispellings, and compilation issues, and then submit pull requests to fix the is…

I actually just replied with a suggestion that Github should implement some built-in functionality for simple error-checking. I think it's a great idea. It would be really helpful if you got a simple little list of notifications for a commit indicating possible error points.

avoid feature creep! github's platform allows for bots to run, a bot is a perfect way to implement this instead of it being "built-in".

Re: Search: .lenght - Github

#34
post #4
post #2

A common typo, it seems. But I'm a bit confused as to why this was submitted.

In JavaScript, if you check for a non-existent property on a variable (e.g. aVar.lenght vs aVar.length) it will return "undefined". So people often rely on this behaviour to check if something is an array or not (no comment on whether this is good or bad), with: if(somethingThatMightBeAnArray.length){ // do things with array } So misspelling of length can be making a lot of code out there behave in an unexpected way.

The same pattern is widely used to test whether an array-like object is empty. Since a length of 0 is also "falsey", it evaluates as false when the array has no elements. A typo in this case would result in the tested array always being "empty".

Re: Search: .lenght - Github

#36
My experience is more with languages that are typically compiled and would report this error as an error fairly early on, so the coder would correct it long before checking the code in.

What's the trade-off by having "undefined" returned instead of having an error reported as soon as the code is loaded?

Re: Search: .lenght - Github

#37
post #2

A common typo, it seems. But I'm a bit confused as to why this was submitted.

In a static language this would be flagged as an error. I assume something less than ideal happens in languages such as Ruby. I once worked at a company where a very early piece of code had a typo "properites" instead of "properties". This misspelling became institutionalized, and was used throughout the codebase because it was deemed too expensive to fix. And this was with a static language (with good IDE refactorin…

There are ways to raise this sort of error even in static languages: objc_sendMessage comes to mind

Re: Search: .lenght - Github

#38
post #2

A common typo, it seems. But I'm a bit confused as to why this was submitted.

I had this problem as a junior dev when my english was weaker. The problem stems from that 'height' is spelled with 'ht', but width with 'th'. Since one often write those words in conjunction, it is easy to mix the endings up. If you're then a non-native speaker and don't run spellcheck on your code, you might end up writing 'lenght' and 'heigth' quite a few times, I know I did :)

Re: Search: .lenght - Github

#39
post #9

Earlier quoted context omitted.

In a static language this would be flagged as an error. I assume something less than ideal happens in languages such as Ruby. I once worked at a company where a very early piece of code had a typo "properites" instead of "properties". This misspelling became institutionalized, and was used throughout the codebase because it was deemed too expensive to fix. And this was with a static language (with good IDE refactorin…

I'm confused as to why they couldn't simply: grep -R properites .

The whole software infrastructure was a scary house of cards. They were afraid that there was unknown code that might be depending on it. For example RESTful services in other departments that were not under our immediate control.

Re: Search: .lenght - Github

#40
post #31

I thought this is actually interesting but I would like to know if >4k misspellings is a lot or not. Here is one way to do it: LANGUAGE #LENGHT #LENGTH = #LENGHT/#LENGTH JavaScript 4252 2907459 = 0.0015 C 18981 2902857 = 0.0065 Java 7706 2348900 = 0.0033 Ruby 10789 1690604 = 0.0064 C++ 9458 1315552 = 0.0072 PHP 3116 1167924 = 0.0027 C# 1352 937647 = 0.0014 Python 3662 737292 = 0.0050 Ruby 1232 380484 = 0.0032 Perl 12…

C# I can understand being so low, since it's almost always written in Visual Studio or MonoDevelop (both of which provide autocompletion). But how is JavaScript the next lowest?
Post reply on HN