Fiber

Languages and libraries

python recursion library

SHOW HN2021

Fiber

Python decorator that enables arbitrarily-deep tail/non-tail recursion

github.com

#python#recursion#tail call#trampoline#coroutine

119points
21comments
#435of 2,533 in 2021
Top 18%of 2021 by points

How HN took it

CuriousMostly questions and neutral comments

0 positive, 5 neutral or asking, 0 mixed, 3 critical, out of 8 comments about the project. Thread score -0.21.

Docs: 0 for, 1 againstIdea: 0 for, 1 againstExecution: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

Objections

  • Scheduler only runs functions to completion and does not yield except on recursive calls

    From 1 comment
    • 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…
      tylerhou on HN
  • Rewritten functions are hard to debug

    From 2 comments
    • 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…
      a-dub on HN
    • 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/logging statements…
      tylerhou on HN

Requests

  • Compare with tail-call optimization (tco)

    From 1 comment

Questions

  • Can recursive functions be automatically rewritten as iterative ones?

    From 2 comments
    • 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…
      a-dub on HN
    • > 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…
      thaumasiotes on HN

Alternatives named

  • Tail-call optimization (tco)

    From 1 comment
  • Continuation-passing style in Lisp

    From 1 comment
    • > 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…
      jhanschoo on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/29628772)