[Top][All Lists]

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

Re: [Emacs-diffs] trunk r116995: cl-lib defstruct introspection

From: Daniel Colascione
Subject: Re: [Emacs-diffs] trunk r116995: cl-lib defstruct introspection
Date: Mon, 21 Apr 2014 19:07:11 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 04/21/2014 07:03 PM, Stefan Monnier wrote:
>> Can it? I tried it in vc-dir and got a completely unrelated ChangeLog hunk.
> Yes, there's a long-standing problem in vc-dir, such that it only works
> well if you mark the files you're going to commit (basically the
> changelog-copying feature needs the list of files that will be committed
> and vc-dir doesn't provide it unless you manually mark each file).
> Patch welcome.
>>>>> I'm curious: when/where did you bump against a need for that?
>>>> I have a few private macros that lexically bind structure slots,
>>> Which part makes it impossible/impractical to use standard accessors for
>>> that?
>> :conc-name, for starters. Also, :read-only, although you could argue
>> that you shouldn't go around mutating read-only slots anyway.
> I guess I don't know what you mean by "lexically bind structure slots".
> Can you give an example?

Something like this. (This is the private code I was talking about, so
it doesn't use the sames in the checked-in patch.)

(defmacro* jez-with-slots (spec-list (type inst) &body body)
  "Like `with-slots', but for structs."
  (if (symbolp inst)
           ,(loop for spec in spec-list
                  collect `(,spec (jez-slot-value ',type ,inst ',spec)))
    (let ((inst-symbol (gensym "with-struct-slots")))
      `(let ((,inst-symbol ,inst))
             ,spec-list ,inst-symbol ,@body)))))

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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