lua-users home
lua-l archive

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


On Sat, Oct 25, 2008 at 3:30 PM, David Manura <dm.lua@math2.org> wrote:
> I was wondering what guarantees of exception safety[1] are provided in Lua.
>
>  local function g()
>    local x=1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20,
>            21,22,23,24,25,26,27,28
>  end
>  local x = 1
>  local function test()
>    x = x + 1  -- INC
>    g()
>    x = x - 1   -- DEC
>  end

If you want to deal with memory allocation errors, you have to write
all your code as if an error can be raised at any time, don't you?
What other choices are there?

Sam