all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Cc: Lars Brinkhoff <lars@nocrew.org>
Subject: Re: [Emacs-diffs] scratch/record 3a49f62 4/4: Make cl-defstruct use records by default.
Date: Wed, 15 Mar 2017 19:40:45 -0400	[thread overview]
Message-ID: <jwvd1diun8q.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <20170315214918.36D29208EF@vcs0.savannah.gnu.org> (Lars Brinkhoff's message of "Wed, 15 Mar 2017 17:49:18 -0400 (EDT)")

>  (defun cl--generic-struct-tag (name &rest _)
> -  ;; It's tempting to use (and (vectorp ,name) (aref ,name 0))
> -  ;; but that would suffer from some problems:
> -  ;; - the vector may have size 0.
> -  ;; - when called on an actual vector (rather than an object), we'd
> -  ;;   end up returning an arbitrary value, possibly colliding with
> -  ;;   other tagcode's values.
> -  ;; - it can also result in returning all kinds of irrelevant
> -  ;;   values which would end up filling up the method-cache with
> -  ;;   lots of irrelevant/redundant entries.
> -  ;; FIXME: We could speed this up by introducing a dedicated
> -  ;; vector type at the C level, so we could do something like
> -  ;; (and (vector-objectp ,name) (aref ,name 0))
> -  `(and (vectorp ,name)
> -        (> (length ,name) 0)
> -        (let ((tag (aref ,name 0)))
> -          (and (symbolp tag)
> -               (eq (symbol-function tag) :quick-object-witness-check)
> -               tag))))
> +  `(and (recordp ,name) (aref ,name 0)))

Actually, you can use `type-of`, here (IOW it can use the same code as
the one used for builtin types, which will make dispatch more efficient
for generic functions which have methods both for structs and for
builtin types).

> -    (if (eq type 'record)
> -        (setq named t))

We don't need to support (:type record).  `record` should simply be used
by default in the absence of any (:type ...).


        Stefan



           reply	other threads:[~2017-03-15 23:40 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20170315214918.36D29208EF@vcs0.savannah.gnu.org>]

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

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

  git send-email \
    --in-reply-to=jwvd1diun8q.fsf-monnier+emacsdiffs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=lars@nocrew.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.