[{"data":1,"prerenderedAt":218},["ShallowReactive",2],{"project-29628772":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":29,"sentiment":30,"stance_mix":31,"scored_comments":35,"aspects":36,"strip":42,"post_text":43,"what":44,"said":66,"maker_in_thread":113,"shape":121,"grid":126,"attempts":179,"same_week":180,"maker_shows":38,"maker_hidden":210,"reader_version":211,"card":212},"29628772","Fiber","Python decorator that enables arbitrarily-deep tail\u002Fnon-tail recursion","title","Show HN: Python decorator that enables arbitrarily-deep tail\u002Fnon-tail recursion","https:\u002F\u002Fgithub.com\u002Ftylerhou\u002Ffiber","github.com","tylerhou",1640027508,2021,119,21,435,2533,18,"notable","languages","python recursion library","library",[24,25,26,27,28],"python","recursion","tail call","trampoline","coroutine","curious",-0.214,{"positive":32,"neutral":33,"mixed":32,"critical":34},0,5,3,8,{"docs":37,"idea":39,"performance":40,"execution":41},{"positive":32,"critical":38},1,{"positive":32,"critical":38},{"positive":32,"critical":32},{"positive":32,"critical":38},[32,38,32,34,34,32,34,32,34,32,32,32,32,32,32,32,32,38,34,38,32],null,{"problem":45,"audience":43,"pricing":43,"motivation":51,"time_to_build":43,"stack":58,"openness":63,"stage":64,"team_size":65},{"value":46,"source":47,"evidence":48},"Python limits recursion depth; deep recursive functions fail","inferred",[49],{"id":50},"post",{"value":52,"source":53,"evidence":54},"Demonstrate pausing and resuming functions without runtime support using AST rewrites","maker",[55],{"id":56,"by":11,"text":57},"29629118","Hi HN, I wrote this. Admittedly Fiber is not the best name — in the current implementation we don't yield to the scheduler except for recursive function calls, and our…",[59],{"value":60,"source":53,"evidence":61},"Python",[62],{"id":56,"by":11,"text":57},"open_source","prototype","unknown",{"praise":67,"objections":68,"requests":84,"questions":92,"alternatives":101},[],[69,73],{"value":70,"source":53,"evidence":71},"Scheduler only runs functions to completion and does not yield except on recursive calls",[72],{"id":56,"by":11,"text":57},{"value":74,"source":75,"evidence":76},"Rewritten functions are hard to debug","commenter",[77,81],{"id":78,"by":79,"text":80},"29629475","a-dub","neat idea, but i'm guessing that a rewritten function would be nightmarish to debug... or no? wonder if it would be possible to do automated rewrites of recursive functions as…",{"id":82,"by":11,"text":83},"29629534","Yeah, debugging the written function is not easy, but that could be improved by adding the normal tools for rewrites (sourcemap). Also, you can put print\u002Flogging statements…",[85],{"value":86,"source":75,"evidence":87},"Compare with tail-call optimization (tco)",[88],{"id":89,"by":90,"text":91},"29636007","KolenCh","May be compare to tco which is not as general.",[93],{"value":94,"source":75,"evidence":95},"Can recursive functions be automatically rewritten as iterative ones?",[96,97],{"id":78,"by":79,"text":80},{"id":98,"by":99,"text":100},"29634856","thaumasiotes","> wonder if it would be possible to do automated rewrites of recursive functions as iterative ones. Of course. > specifically for cases where stack memory that grows in a…",[102,106],{"value":103,"source":75,"evidence":104},"Tail-call optimization (tco)",[105],{"id":89,"by":90,"text":91},{"value":107,"source":75,"evidence":108},"Continuation-passing style in Lisp",[109],{"id":110,"by":111,"text":112},"29633690","jhanschoo","> wonder if it would be possible to do automated rewrites of recursive functions as iterative ones. specifically for cases where stack memory that grows in a recursive…",{"comments":114,"answered":34,"key":115},7,[116,117,120],{"id":56,"text":57},{"id":118,"text":119},"29629229","You're right, fixed.",{"id":82,"text":83},{"commenters":122,"max_depth":123,"maker_replies":114,"first_comment_mins":124,"lifespan_hours":125},12,9,27,85,[127,129,133,135,136,137,138,140,142,146,150,152,156,159,161,163,166,169,173,174,176],[56,32,32,128,11,38],"project\u002Fneutral\u002Fidea",[130,32,38,131,132,32],"29629210","project\u002Fcritical\u002Fdocs","Tistron",[118,32,32,134,11,38],"maker\u002Fneutral\u002Fdocs",[89,32,34,128,90,32],[78,38,34,128,79,32],[82,38,32,128,11,38],[139,38,34,128,79,32],"29629649",[141,38,32,128,11,38],"29630139",[143,38,34,144,145,32],"29630079","project\u002Fneutral\u002Fperformance","vitus",[147,38,32,148,149,32],"29632279","other\u002Fneutral\u002Fperformance","falcor84",[151,38,32,148,11,38],"29632408",[153,38,32,154,155,32],"29635432","commenter\u002Fcritical\u002Fnone","patrick451",[157,38,32,158,11,38],"29635704","commenter\u002Fneutral\u002Fnone",[160,38,32,154,155,32],"29645715",[162,38,32,158,11,38],"29656010",[164,38,32,165,79,32],"29671411","other\u002Fneutral\u002Fnone",[167,38,32,158,168,32],"29663484","hansvm",[170,38,38,171,172,32],"29631772","project\u002Fcritical\u002Fexecution","chrisseaton",[110,38,34,128,111,32],[98,38,38,175,99,32],"project\u002Fcritical\u002Fidea",[177,38,32,154,178,32],"29637760","coldtea",[],[181,185,190,195,200,205],{"id":182,"name":183,"points":184,"category":20},"29630293","SectorLISP",513,{"id":186,"name":187,"points":188,"category":189},"29620235","fourlightyears.blogspot.com",343,"hardware",{"id":191,"name":192,"points":193,"category":194},"29637188","SlikSafe",284,"infrastructure",{"id":196,"name":197,"points":198,"category":199},"29605429","Lindy Hacker News",221,"learning_science",{"id":201,"name":202,"points":203,"category":204},"29622970","All Black Screen",121,"web_saas",{"id":206,"name":207,"points":208,"category":209},"29595512","DataQA",116,"ai",false,"v2",{"id":213,"name":5,"line":6,"ai":210,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":214,"top":18,"kw":215,"maker":11,"domain":10,"tier":19,"attempts":32,"strip":216,"url":9,"mix":217,"praise":-1,"objection":70,"sub":21},29628772,-0.21,[24,25,26,27,28],"010330303000000001310",[32,33,32,34],1794036614411]