News for hackers. Stuff that matters.
Re:Koa – Next-generation web framework for Node.js by quarterto on Thursday December 19, 2013 @04:58AM (#6933749)
0s: "next generation web framework for node.js" (oh god, not another)

5s: "designed by the team behind Express" (wait what?)

6s: "Through leveraging generators Koa allows you to ditch callbacks" (wow, ok. oh hey, that makes "next generation" not just marketing fluff)

18s:

  app.use(function *(next){
    var start = new Date;
    yield next;
    var ms = new Date - start;
    this.set('X-Response-Time', ms + 'ms');
  });
(oh sweeet)
Re:Koa – Next-generation web framework for Node.js by joenied on Thursday December 19, 2013 @09:31AM (#6934806)
I found the GIF on this page explains it pretty good: https://github.com/koajs/koa/blob/master/docs/guide.md
Re:Koa – Next-generation web framework for Node.js by bsiddiqui on Thursday December 19, 2013 @12:46PM (#6936267)
pretty well
Re:Koa – Next-generation web framework for Node.js by FooBarWidget on Thursday December 19, 2013 @05:06AM (#6933766)
Reading this comment makes me sad. Does this mean you would have immediately closed the tab, irregardless of technology, if they didn't namedrop?
Re:Koa – Next-generation web framework for Node.js by quarterto on Thursday December 19, 2013 @05:08AM (#6933771)
I was already giving it the benefit of the doubt by reading any further than "next generation web framework for node.js".
Re:Koa – Next-generation web framework for Node.js by easy_rider on Thursday December 19, 2013 @07:54AM (#6934343)
Couldn't agree more. Happy that I did though.
Re:Koa – Next-generation web framework for Node.js by mathrawka on Thursday December 19, 2013 @05:24AM (#6933814)
Too many things claim to be a "next generation framework", that it usually is a let down because it is just a rehash of something.

But this is something new that looks like it can be good. I've been wondering when it would be announced, as TJ has been working on it for a while: https://github.com/visionmedia?tab=activity

Re:Koa – Next-generation web framework for Node.js by sergiotapia on Thursday December 19, 2013 @10:03AM (#6934988)
Offtopic: *irregardless is not a word, Just use regardless.
Re:Koa – Next-generation web framework for Node.js by ehsanu1 on Thursday December 19, 2013 @10:07AM (#6935012)
Like it or not, irregardless is here to stay. Languages change, mispellings become the correct way to spell things, words become their own antonyms, and a lot of other very strange things. Embrace it!
Re:Koa – Next-generation web framework for Node.js by ahallock on Thursday December 19, 2013 @11:10AM (#6935491)
It's just wrong. Why embrace things that don't make sense? Are we embracing the Idiocracy?
Re:Koa – Next-generation web framework for Node.js by swalkergibson on Thursday December 19, 2013 @10:27AM (#6935128)
I reject your implication. Just because a lot of people use it does not make it grammatically accurate.

http://en.wikipedia.org/wiki/Irregardless

Re:Koa – Next-generation web framework for Node.js by JangoSteve on Thursday December 19, 2013 @10:43AM (#6935252)
> Just because a lot of people use it does not make it grammatically accurate.

Actually, that's exactly what it does... over time. Where exactly do you think our language, as it exists today, came from?

Re:Koa – Next-generation web framework for Node.js by ds_ on Thursday December 19, 2013 @11:00AM (#6935404)
Re:Koa – Next-generation web framework for Node.js by 3minus1 on Thursday December 19, 2013 @11:14AM (#6935517)
@swalkergibson flammable and inflammable both mean the same thing.
Re:Koa – Next-generation web framework for Node.js by swalkergibson on Thursday December 19, 2013 @11:20AM (#6935558)
Re:Koa – Next-generation web framework for Node.js by swalkergibson on Thursday December 19, 2013 @11:03AM (#6935439)
Of course language evolves, but a double-negative is a double-negative, no matter how you slice it. Do you have another example of a single word that is a double-negative?
Re:Koa – Next-generation web framework for Node.js by testing12341234 on Thursday December 19, 2013 @05:02PM (#6938232)
And yet one of the father's of written modern English, Chaucer himself often used double negatives [0].

ex:

"Ther nas no man no wher so vertuous" ("There never was no man nowhere so virtuous")

"He nevere yet no vileynye ne sayde / In all his lyf unto no maner wight" ("He never yet no vileness didn't say / In all his life to no manner of man").

The modern English language (written and spoken) has been in constant flux for the last 600+ years. What was once required is now antiquated, and what was once verboten is now required.

At this moment in time, double negatives are frowned upon. However, that may change in the future, and it's possible that irregardless is the start of a new set of changes in the language.

[0] - http://en.wikipedia.org/wiki/Double_negative

Re:Koa – Next-generation web framework for Node.js by dragonwriter on Thursday December 19, 2013 @05:08PM (#6938265)
> And yet one of the father's of written modern English, Chaucer himself often used double negatives [0].

It's worth noting that neither of your examples has a double negative. Triple negative (the second possibly quadruple), sure, but not double.

> At this moment in time, double negatives are frowned upon.

I don't know that there's really a shift in time with the double negative, its a stylistic rule, and, much like the Pirate Code, stylistic rules in English are more what you'd call guidelines than actual rules.

Or, looked at another way, more like training wheels.

Re:Koa – Next-generation web framework for Node.js by testing12341234 on Thursday December 19, 2013 @07:18PM (#6938983)
Guidelines indeed. For reference, here is an example of a double negative from the Prologue to the Canterbury Tales:

Nowher so bisy a man as he ther nas [0] (Nowhere so busy a man as he there none)

[0] http://www.bartleby.com/40/0102.html line 321

Re:Koa – Next-generation web framework for Node.js by nekopa on Thursday December 19, 2013 @11:52AM (#6935824)
Unless?
Re:Koa – Next-generation web framework for Node.js by bicknergseng on Thursday December 19, 2013 @12:53PM (#6936324)
Oh snap.
Re:Koa – Next-generation web framework for Node.js by krsunny on Thursday December 19, 2013 @08:09PM (#6939240)
Welcome to Hacker News, home of the worlds largest contrarian user base.
Re:Koa – Next-generation web framework for Node.js by ricardobeat on Thursday December 19, 2013 @12:15PM (#6936010)
That link, and the mere fact it exists, contradicts your point. Irregardless is a word [...]

Irregardless, it's not about being grammatically correct, but being socially accepted and understood; just like slang and broken grammar that develops in subcultures, it ain't no goin anywhere!

Re:Koa – Next-generation web framework for Node.js by swalkergibson on Thursday December 19, 2013 @01:09PM (#6936430)
So why would you want to use it? What is the point of saying irregardless vis-a-vis irrespective or regardless?
Re:Koa – Next-generation web framework for Node.js by saraid216 on Thursday December 19, 2013 @06:19PM (#6938720)
Trolling the language police is a pretty good reason, actually.
Re:Koa – Next-generation web framework for Node.js by jimmcslim on Thursday December 19, 2013 @11:02PM (#6939858)
I am whelmed by this whole conversation!
Re:Koa – Next-generation web framework for Node.js by typeslower on Thursday December 19, 2013 @12:20PM (#6936072)
Is it fair to call this willful ignorance?
Re:Koa – Next-generation web framework for Node.js by usethis on Thursday December 19, 2013 @05:24AM (#6933809)
it's because of the hyperbole:

> next generation web framework for node.js

I don't think they need that, just list the stand-out features first. And yes, referring to past accomplishments does give it more credibility.

Re:Koa – Next-generation web framework for Node.js by eknkc on Thursday December 19, 2013 @06:40AM (#6934028)
This utilizes generators heavily. Generators are within the ES6 spec, which is the next generation of JavaScript.

This might be one of the very few instances that "next generation" is a valid statement.

Re:Koa – Next-generation web framework for Node.js by tolas on Thursday December 19, 2013 @01:57PM (#6936876)
You don't believe in social proof and a history of success?
Re:Koa – Next-generation web framework for Node.js by RivieraKid on Thursday December 19, 2013 @07:13AM (#6934170)
I would.
Re:Koa – Next-generation web framework for Node.js by Gigablah on Thursday December 19, 2013 @05:32AM (#6933838)
Saw something similar in Martini (golang):

https://github.com/codegangsta/martini#next

    // log before and after a request
    m.Use(func(c martini.Context, log *log.Logger){
      log.Println("before a request")

      c.Next()

      log.Println("after a request")
    })
Re:Koa – Next-generation web framework for Node.js by bjconlan on Thursday December 19, 2013 @07:14AM (#6934171)
I don't think this yields the current thread/routine though does it? I think what you are seeing here is closer to express':

  function(req, res, next) {
    console.log('before');
    next(); // go to the next middleware handler
    console.log('after the middleware stack has been traversed');  
  }
Re:Koa – Next-generation web framework for Node.js by andreypopp on Thursday December 19, 2013 @08:29AM (#6934490)
I think does yield as stated in docs. Go have coroutines so there is no need in generators.
Re:Koa – Next-generation web framework for Node.js by flym4n on Thursday December 19, 2013 @07:16AM (#6934179)
That's using a callback, like express or connect does. What's new in koa is the use of js generators
Re:Koa – Next-generation web framework for Node.js by jerf on Thursday December 19, 2013 @09:32AM (#6934815)
Go doesn't need JS generators. It already handles execution flow correctly. It is not correct to assume the Node execution model holds everywhere; we've made a lot of great advances since the old event-based model was invented in the 70s. That actually wraps the full handler without any need to jump through event threading hoops, and is not "blocking", in the sense that the Node community uses the term. That's an out-of-the-box feature for a modern language.
Re:Koa – Next-generation web framework for Node.js by klibertp on Thursday December 19, 2013 @10:23AM (#6935106)
> That's an out-of-the-box feature for a modern language.

Or for any Scheme for the last 30 years, but don't let that change your views on how "modern" you language is :)

Re:Koa – Next-generation web framework for Node.js by jerf on Thursday December 19, 2013 @10:57AM (#6935376)
"Everything" was invented by the 70s (and a lot in the 60s); unfortunately the huge stinking popularity of GUIs combined with relentless drum beats of the latest code being due out yesterday took us on a decades-long detour through what turned out to be some bad ideas (OO in the "model the physical world" sense, which GUI frameworks deceptively made appear to work, event-based systems which are simple spaghetti-code redux in the Dijkstra sense of "spaghetti code").
Re:Koa – Next-generation web framework for Node.js by munificent on Thursday December 19, 2013 @12:54PM (#6936333)
Compared to JavaScript, Scheme is a modern language!
Re:Koa – Next-generation web framework for Node.js by dlau1 on Thursday December 19, 2013 @05:10AM (#6933777)
It looks almost like if they rewrote express for generator functions

I can't wait to drop this in to one of my projects!

Re:Koa – Next-generation web framework for Node.js by ds_ on Thursday December 19, 2013 @06:00AM (#6933910)
That's pretty much what they did (and connect, which was the foundation of express and since bought by senchalabs).
Re:Koa – Next-generation web framework for Node.js by STRML on Thursday December 19, 2013 @11:05AM (#6935459)
Wasn't connect written by senchalabs in the first place, not bought?
Re:Koa – Next-generation web framework for Node.js by netghost on Thursday December 19, 2013 @11:35AM (#6935668)
I think they funded its development, so yes and no.
Re:Koa – Next-generation web framework for Node.js by mateuszf on Thursday December 19, 2013 @05:05AM (#6933764)
So, does node support generators out of the box?
Re:Koa – Next-generation web framework for Node.js by quarterto on Thursday December 19, 2013 @05:06AM (#6933769)
It's behind a flag (--harmony-generators) in 0.11 (current stable is 0.10, hence my "next generation" comment).