GNU bug report logs - #69749
(bindat-type sint 32 t) -> unbound variable bitlen

Previous Next

Package: emacs;

Reported by: Eric Marsden <eric.marsden <at> risk-engineering.org>

Date: Tue, 12 Mar 2024 15:20:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eric Marsden <eric.marsden <at> risk-engineering.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 69749 <at> debbugs.gnu.org
Subject: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen
Date: Fri, 15 Mar 2024 12:51:36 -0400
>> Your code ends up (via the `sint` of `bindat-type`) relying on the
>> `lexical-binding` dialect of ELisp, which is enabled by default in
>> `ielm` but not in your file.
> Indeed, thanks for the fix.
> Perhaps it would be useful for the bindat-type macro to emit a warning when
> it is running in the dynamic-binding dialect (at least for the types that
> require lexical binding)?

Agreed.  I just pushed a corresponding patch to `master`.
It impacts only `sint` (among the predefined types).

> This would have no runtime cost when byte-compiled or native-compiled,
> I assume.

The patch I installed indeed doesn't impact the performance of the code.
The underlying detail which requires `lexical-binding` to be active does
cause the code for `sint` to be significantly less efficient than that
for `uint`, tho, so if performance is important, you may prefer to use
`uint` and do the conversion to a signed integer manually elsewhere. 🙁


        Stefan





This bug report was last modified 1 year and 144 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.