Comment

Comment by srhtftw

I had the pleasure of working with Lua 5.1 back in the late noughties. For me it replaced Tcl whenever I wanted something I could configure above a C library. At the time I used it I found it quite nice but I'll also not forget the hours I wasted tracking down nil table corruptions which could have easily been caught by a type checker.

I had some hope that Luau https://luau-lang.org or Teal https://github.com/teal-language/tl would make things better but with the following example

    function foo(x: number): string 
      if x == 2 then return nil else return "foo" end
    end
    
    x = { foo(1), foo(2), foo(3) }
    
    for i,v in ipairs(x) do
     print(i,v)
    end
they produce no warning and sadly only print

    1 foo
When I was younger I might have put up with that sort of WTF but now that I have better options I try to stick to type checked languages where I don't have to.
parent srhtftw 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton