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: Clément Pit-Claudel
Subject: bug#31715: cl-incf and cl-decf error out when passed a nil-valued variable as 'offset'
Date: Tue, 5 Jun 2018 19:36:41 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 2018-06-05 19:26, Noam Postavsky wrote:
> Clément Pit-Claudel <address@hidden> writes:
> 
>> I'm not sure what to make of the result with SBCL and CLisp, since
>> (incf x nil) also fails in both of them (whereas it works for us,
>> since we can't distinguish nil and unspecified).
> 
> Oh, huh, I didn't think to check that case.  Maybe we should just change
> cl-incf to disintguish between nil and unspecified then.

Hmm, neat trick! Wouldn't that be backwards-incompatible, though?
Plus, it's not common for ELisp functions to distinguish between unspecified 
and nil, and changing cl-incf that way would make it less convenient to wrap in 
other macros.  If it doesn't had runtime costs, I'd be in favor of going the 
other route, and making sure that (cl-incf x y) adds 1 even when y is bound to 
nil.

>>> I don't think those are great examples of macros to emulate.
>>
>> Agreed, I was just collecting other examples, both in support and against my 
>> point.
> 
> Yeah, I just meant we can't really use those examples either to support
> or argue against your point.

OK :)

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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