octave-maintainers
[Top][All Lists]
Advanced

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

Re: More format() changes


From: John W. Eaton
Subject: Re: More format() changes
Date: Wed, 16 Oct 2019 12:11:41 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 10/16/19 11:16 AM, Rik wrote:

Alternatively, we could use Octave's own unwind_protect
class and the protect_var method, but I'm not sure if that does what we
want in this instance which is to let the change happen, unless an error is
thrown, in which case the variable needs to be restored.

This approach is probably the simplest thing and most like other code in Octave that needs to reset some internal program state on an error. To prevent the changes from reverting if there is no error, you can discard the actions of an unwind_protect object. I think the attached patch should do it.

It would be a little easier if all format settings were stored in a single object instead of as individual file-scope or global variables. I'm headed in that direction anyway, as I think all this info should be stored as part of the interpreter object instead of globally, but that's a project for another day.

jwe


Attachment: format-state-diffs.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]