dsafgdafgdf45345 2012-08-28 22:44
浏览 45
已采纳

使用Python和Ruby进行Web编程的协程或延续。 为什么不? [关闭]

The question is: why aren't continuations (in Ruby) and coroutines (in Python) more widely used for Web programming?

Server-side web programming is made difficult by the problem of preserving state between requests. Two elegant, and related, solutions to this are continuations (as found in Scheme, Ruby and Smalltalk) and coroutines (as found in Python and Go).

Bruce Tate in his Beyond Java (O'Reilly, 2005) talked about Ruby on Rails and Seaside as exciting new developments in Web programming. To me, Seaside was the real breakthrough: using Smalltalk continuations, Seaside made it very easy to program complex request/response sequences.

I know about Python coroutines being used in Tornado and Twisted to reduce callbacks, but that is somewhat low-level, compared to writing a view/controller in a single coroutine to handle a sequence of HTTP requests to complete an online purchase, for example.

I wonder why these ideas that look so good on paper are not more widely deployed in Python and Ruby. Is it just a cultural matter? Limitations in the facilities as implemented in these languages? Or is there a fundamental flaw in these approaches in the context of Web development?

  • 写回答

3条回答 默认 最新

  • duan198811 2012-08-29 02:40
    关注

    I've used Seaside and continuations are a beautiful model for developing client server webapps. They simplify traditional client/server applications that I couldn't believe why no other langugage was doing it.

    But unfortunately webapps aren't what they used to be. Instead of the requesting only one page, now with ajax there are multiple requests at different times. That is why continuations aren't as useful as they used to be.

    Even Avi Bryant (original author of Seaside) has said that under ajax making callbacks easier (event driven programming) is more important than continuations.

    Take a look at this quora discussion for more: http://www.quora.com/Whats-the-best-continuation-based-web-framework

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥15 小红薯封设备能解决的来
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答
  • ¥20 在本地部署CHATRWKV时遇到了AttributeError: 'str' object has no attribute 'requires_grad'
  • ¥15 vue+element项目中多tag时,切换Tab时iframe套第三方html页面需要实现不刷新
  • ¥50 深度强化学习解决能源调度问题
  • ¥15 一道计算机组成原理问题