unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: Daniel Colascione <dancol@dancol.org>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: make-vector documentation is wrong
Date: Thu, 14 May 2020 23:41:52 -0400	[thread overview]
Message-ID: <jwv8shtna1j.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <5bcc3508-9d65-c5b4-255e-898f8e1dc3c1@cs.ucla.edu> (Paul Eggert's message of "Thu, 14 May 2020 19:46:09 -0700")

> (make-string 0 0), (make-list 0 0), (vector), and (list) all have the property
> that (make-vector 0 0) does - that is, each call returns the same empty object
> each time. I imagine that make-vector was implemented to be consistent with the
> other functions - at least, this behavior appears to be a conscious decision
> rather than accidental. So it may make sense to change these functions'
> documentation instead of their implementation's longstanding behavior.

Actually, IIRC, for vectors it wasn't done "to make things consistent"
but because it simplified the memory management (IIRC the malloc-like
level needed its smallest object to be bigger than a 0-length vector,
so instead of adding an ad-hoc exception for 0-length vectors to
artificially use up more space, we decided to return a constant because
it was both simpler and more efficient).

I can't see any strong argument either for making sure (vector) returns
a fresh object nor for enforcing that it always returns the same object,
so I'd favor a documentation that says both things are valid
(i.e. Elisp code shouldn't rely on either behavior).


        Stefan




  parent reply	other threads:[~2020-05-15  3:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  1:36 make-vector documentation is wrong Daniel Colascione
2020-05-15  2:46 ` Paul Eggert
2020-05-15  2:59   ` Daniel Colascione
2020-05-15  3:19     ` Paul Eggert
2020-05-15  3:41   ` Stefan Monnier [this message]
2020-05-15  6:34     ` Paul Eggert
2020-05-15  9:58       ` Eli Zaretskii
2020-05-15  6:49   ` Eli Zaretskii

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=jwv8shtna1j.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dancol@dancol.org \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.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 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).