From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] trunk r117987: * internals.texi (Stack-allocated Objects): Describe this feature.
Date: Tue, 30 Sep 2014 16:20:01 -0400 [thread overview]
Message-ID: <jwv8ul027de.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <542B0156.1040001@cs.ucla.edu> (Paul Eggert's message of "Tue, 30 Sep 2014 12:15:34 -0700")
> For example, we'd have to replace this:
> caller = concat3 (SCOPED_STRING (" <"), caller, SCOPED_STRING (">"));
> with something like this:
> SCOPED_STRING (space_lessthan, " <");
> SCOPED_STRING (greaterthan, ">");
> caller = concat3 (space_lessthan, caller, greaterthan);
Well, the second looks much better to me. Its semantics is much clearer.
The extra verbosity helps the programmer think a bit harder about what
she's doing and whether it is really safe to use stack allocation.
> Regardless of whether we use declaration-style macros, there is one thing
> I'd like to change: the macro names. These macros are not about *scope*;
> they are about *lifetime*. How about the prefix "auto_" (from the C keyword
> 'auto') rather than "scope_"? Or maybe "block_" because it's block
> lifetime? ("auto_" is shorter....)
Maybe it's too obvious, but how 'bout STACK_ALLOC_STRING?
Bikeshedding et al.
> Also, I capitalized SCOPED_STRING on the theory that it is often not
> implemented as a function. On second thought since it can be (and sometimes
> is) implemented as a function I'm thinking we should make it lower-case, as
> scoped_cons etc. are. (Correcting its prefix of course.)
That's another advantage of the declaration version: there's no arguing
whether it should be capitalized or not, since it can't be implemented
as a function.
Stefan
next prev parent reply other threads:[~2014-09-30 20:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1XYzSf-00075J-Dr@vcs.savannah.gnu.org>
2014-09-30 17:55 ` [Emacs-diffs] trunk r117987: * internals.texi (Stack-allocated Objects): Describe this feature Stefan Monnier
2014-09-30 19:15 ` Paul Eggert
2014-09-30 19:29 ` Eli Zaretskii
2014-09-30 19:49 ` David Kastrup
2014-09-30 20:20 ` Stefan Monnier [this message]
2014-10-01 3:31 ` Paul Eggert
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=jwv8ul027de.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--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 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.