News for hackers. Stuff that matters.
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!