bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#31715: cl-incf and cl-decf error out when passed a nil-valued variab


From: Michael Heerdegen
Subject: bug#31715: cl-incf and cl-decf error out when passed a nil-valued variable as 'offset'
Date: Tue, 05 Jun 2018 01:43:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Noam Postavsky <address@hidden> writes:

> X is an optional macro parameter, so the "optionalness" applies at
> compile time.

Are you sure we always treat optional macro parameters like this?

> I think that would approximately double the cost of cl-incf in the
> simple case [...]

We could drop the optimization in case an X expression is specified,
resulting in one additional `or' call:

(defmacro cl-incf (place &optional x)
  (if (and (symbolp place) (not x))
      (list 'setq place (list '1+ place))
    (list 'cl-callf '+ place (or x 1))))

Would that be significantly slower than the current definition?


Michael.





reply via email to

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