unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: Lars Ingebrigtsen <larsi@gnus.org>, Philipp <p.stephani2@gmail.com>
Cc: 50214@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	[thread overview]
Message-ID: <14be763f-95f6-23c2-7f92-8e4eacb30de4@alphapapa.net> (raw)
In-Reply-To: <87ilmk4a8d.fsf@gnus.org>

Hi Lars,

Thanks for following up on this report.

On 8/22/22 09:35, Lars Ingebrigtsen wrote:
> Philipp <p.stephani2@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





  reply	other threads:[~2022-08-22 21:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 16:47 bug#50214: 28.0.50; cl-struct changes may affect user packages in the wild Adam Porter
2021-08-26 17:50 ` Arthur Miller
2021-08-26 19:37 ` Lars Ingebrigtsen
2021-08-26 20:52   ` Adam Porter
2021-09-04 17:37     ` Philipp
2022-08-22 14:35       ` Lars Ingebrigtsen
2022-08-22 21:24         ` Adam Porter [this message]
2022-08-23 10:08           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14be763f-95f6-23c2-7f92-8e4eacb30de4@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=50214@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).