lua-users home
lua-l archive

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


On Tue, Feb 4, 2014 at 3:00 PM, Rena <hyperhacker@gmail.com> wrote:
> On Tue, Feb 4, 2014 at 5:57 PM, Tim Hill <drtimhill@gmail.com> wrote:
>>
>>
>> On Feb 4, 2014, at 1:57 PM, Rena <hyperhacker@gmail.com> wrote:
>>
>>>
>>> The biggest difference is that __gc metamethods will get called, allowing
>>> the app to cleanup resources (flush to disk, close files etc etc). There is
>>> no difference to dangling memory since the OS will clean all that up anyway
>>> when the process exits (it will close files too, but user-level buffers may
>>> not be flushed).
>>>
>>> —Tim
>>>
>>>
>>
>> I wonder why you'd want the state to *not* be shut down, let alone for
>> that to be the default?
>>
>> --
>> Sent from my Game Boy.
>>
>>
>> I’m not going to speculate why it is or is not the default, but one reason
>> for not doing a close is if you DONT have anything to clean up then it’s a
>> LOT faster.
>>
>> —Tim
>>
>
> Sure, but how fast does exiting your process need to be? That's probably not
> something you do often.

In an error condition, it's less "performance" and more "inconsistent
state" that you have to worry about. An error that's so unrecoverable
as to want to call os.exit() probably means that you DON'T want to
perform any further processing on data that is probably going to do
the Wrong Thing.

The "clean close" option, to my eye, is there more or less to give
scripts the ability to quit the program without having to propagate a
shutdown message all the way up the stack.

/s/ Adam