GNU bug report logs - #50214
28.0.50; cl-struct changes may affect user packages in the wild

Previous Next

Package: emacs;

Reported by: Adam Porter <adam <at> alphapapa.net>

Date: Thu, 26 Aug 2021 16:48:01 UTC

Severity: normal

Tags: moreinfo

Found in version 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Adam Porter <adam <at> alphapapa.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Philipp <p.stephani2 <at> gmail.com>
Cc: 50214 <at> debbugs.gnu.org
Subject: bug#50214: 28.0.50; cl-struct changes may affect user packages in the wild
Date: Mon, 22 Aug 2022 16:24:24 -0500
Hi Lars,

Thanks for following up on this report.

On 8/22/22 09:35, Lars Ingebrigtsen wrote:
> Philipp <p.stephani2 <at> gmail.com> writes:
> 
>>> Unfortunately, I know of no other way to implement what ts.el does
>>> without modifying the accessors, which requires accessing the internal
>>> struct details after it is defined.
>>
>> I haven't checked the code in detail, but AIUI ts.el tries to initialize structure members lazily?  Why not just use a wrapper function for that?
>>
>> (defun ts-hour (ts)
>>    (or (ts--hour ts)
>>        (setf (ts--hour ts) (string-to-number (format-time-string "%H" (ts-unix ts)))))
>>
>> Here ts--hour is the actual accessor, which is private and shouldn't be used outside of ts.el.
> 
> Adam, does this suggestion work for you?

That seems like a good idea to me.  I guess if I define it as an inline 
function, it should have a similar optimization as the current code. 
And the implementation would be much simpler and future-proof as well. 
In hindsight, I should probably have tried that first.  :)

I'll see if I can implement this in ts.el soon and release a new version 
accordingly.  In the meantime, I guess this bug report should be closed. 
 Thanks to all for your help.

Adam




This bug report was last modified 2 years and 274 days ago.

Previous Next


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