Hacker News new | past | comments | ask | show | jobs | submit login

Lua's stack trace includes an indication that 1 or more tail calls happened, but not how many

  $ cat tailrec.lua
  function f(g,n)
    if n == 0 then
      error("oh no")
    end
    return g(g,n-1)
  end
  f(f,5)
  $ lua tailrec.lua
  lua: tailrec.lua:3: oh no
  stack traceback:
   [C]: in function 'error'
   tailrec.lua:3: in function 'f'
   (...tail calls...)
   tailrec.lua:7: in main chunk
   [C]: in ?



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: