octave-maintainers
[Top][All Lists]
Advanced

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

Re: Cleaning up core if/else/error instances


From: John W. Eaton
Subject: Re: Cleaning up core if/else/error instances
Date: Wed, 23 Dec 2015 18:05:40 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0

On 12/22/2015 01:26 PM, Rik wrote:
12/22/15

Andreas et al.,

I made a new page and topic on the Octave Wiki
(http://wiki.octave.org/Invert_if/else/error) around further cleaning up
instances of error() in the core.

Each instance should take just a minute or two, but there are 105, so help
would be appreciated.  I added this to the list of Short Projects on the
Wiki too since this is an easy introduction for new programmers.

A related issue is code that looks like this:

  if (condition)
    error (message);
  else if (other_condition)
    ...

that I believe can now always be rewritten as

  if (condition)
    error (message);

  if (other_condition)
    ...

to remove a level of indentation.

I've been cleaning these up as I spot them while looking primarily for instances of else followed by error.

For now, I've been leaving more complicated things like

  if (condition)
    ...
  else if (other_condition)
    ...
  else
    error (message);

alone since it seems that fixing these requires duplicating and merging conditional expressions.

jwe




reply via email to

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