Live data from Hacker News

GitHub search for 84600 seconds. Oops.

github.com

31–40 of 64 posts

Re: GitHub search for 84600 seconds. Oops.

#36

I wonder if Github will ever reconsider allowing bots [0]. There are bunch of things like this that would be cool to have pull-requests automatically generated for. Security fixes would be another place where I can see bots helping to fix common mistakes. [0] http://www.wired.com/2012/12/github-bots/

Yeah, I'd love to help in some way, but the number of results is huge and without bots I'm discouraged from doing anything manually.

Maybe we can create a resource of common typos in numerical constants that would auto-detect by edit distance? But I suppose most people willing to check a resource like that probably already double check their arithmetic. (That said, I've probably had this exact bug somewhere in my coding history, so no shame.)

Re: GitHub search for 84600 seconds. Oops.

#37

HN Challenge: name a scenario in which defining a constant as 86400 is better then defining it as (60 * 60 * 24). Or, are there languages where you can't declare a constant with a multiplication expression?

To me it's a coding style thing. The argument for 86400 would be, too many operators makes things damn confusing. When your define expands in the preprocessor to a function sixteen operators long, you have made a mess.

Re: GitHub search for 84600 seconds. Oops.

#38

HN Challenge: name a scenario in which defining a constant as 86400 is better then defining it as (60 * 60 * 24). Or, are there languages where you can't declare a constant with a multiplication expression?

> are there languages where you can't declare a constant with a multiplication expression?

obviously PHP.

  php > const X = 1;
  php > echo X;
  1
  php > const Y = 1 * 2;

  Parse error: parse error, expecting `','' or `';'' in php shell code on line 1
  php > echo Y;
  Y

Re: GitHub search for 84600 seconds. Oops.

#39

HN Challenge: name a scenario in which defining a constant as 86400 is better then defining it as (60 * 60 * 24). Or, are there languages where you can't declare a constant with a multiplication expression?

I find myself with pre-optimization issues on my new code and define constants multiplied out rather than add that .000000001% extra overhead of doing the multiplication - it's a sickness.
Post reply on HN