lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Maybe a bit off topic, but if it's any comfort, I checked it against some other functional languages with mutable state - Scheme and OCaml - and Scheme shows the same behavior (at least when used in this way, which I felt was most analogous to the Lua code.)

> (define recursive
    (lambda (n)
      (if (= 0 n)
          void
          (recursive (- n 1)))))
> (recursive 3)
#<procedure void>
> (define renamed recursive)
> (renamed 3)
#<procedure void>
> (define recursive void)
> (renamed 3) 
[Repl(15)] Error: incorrect number of arguments to #<procedure void>.
Type (debug) to enter the debugger.

So as far as I can tell, there seem to be other successful functional languages that act this way.