octave-maintainers
[Top][All Lists]
Advanced

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

Re: proposal for minor new feature


From: Michael D. Godfrey
Subject: Re: proposal for minor new feature
Date: Tue, 02 Mar 2010 09:38:13 -0800
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.8) Gecko/20100216 Thunderbird/3.0.2

On 3/2/10 6:05 AM, Jaroslav Hajek wrote:
hi all,

for a while, Octave has had the "assert" function, to conveniently
test for some conditions and error out on problems.
However, there is no equivalent to NDEBUG in Octave - there is no way
to switch assertions off for performance reasons.

Note that it does not suffice to shadow assert with an empty function;
the point of NDEBUG is to also prevent evaluating the
arguments to the call, which can be expensive. An optimization for
that case would probably work neither, because at the
point of function lookup arguments must already be evaluated.

What I propose is to implement a variable, say, "ignore_assertions",
that would instruct the interpreter to ignore any calls to functions
named "assert".
This would necessarily include user-defined or local assert functions;
as I said, at the point of function lookup it is already too late, so
there is no nice way to distinguish which assert is called. I even
think that it might be good to allow an user write his own assert
(probably extend the library function) and still enjoy the feature.
An even more general case would be to allow a set of names be defined
as asserts, though I see little need for that.

Finally, a yet far more general idea is to allow preprocessing in Octave.
But admittedly, this is the only case I can think of where a
preprocessor in Octave would do any good.

any comments?

-- RNDr. Jaroslav Hajek, PhD computing expert & GNU Octave developer Aeronautical Research and Test Institute (VZLU) Prague, Czech Republic url: www.highegg.matfyz.cz
Very good idea.  It would be great if you did it!

Michael



reply via email to

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