How about `wrap_boolean'? [was: Re: [AC21.5] New BIGNUM and union datatype]

Stephen J. Turnbull stephen at xemacs.org
Wed Apr 7 11:41:35 EDT 2004


>>>>> "Hrvoje" == Hrvoje Niksic <hniksic at xemacs.org> writes:

    Hrvoje> The function returns a C boolean, whereas a DEFUN should
    Hrvoje> return a Lisp_Object.  You should change the return
    Hrvoje> statement to something like:

    Hrvoje>   return ... ? Qt : Qnil;

    Hrvoje> where "..." is the boolean expression used now.

How about

#define wrap_boolean(x) ((x) ? Qt : Qnil)

(wrap_TYPE being the Bennish way of expressing Lispification)?

The reviewing point being that it's generally clear with objects and
functions what they're returning, but with a conditional expression,
you have to check types of all the arms before you know.

Yes, --use-union-type catches this too, but absence of the wrap_ would
look odd to the reviewing eye.

-- 
Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.




More information about the XEmacs-Beta mailing list