emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] trunk r117987: * internals.texi (Stack-allocated Objec


From: Paul Eggert
Subject: Re: [Emacs-diffs] trunk r117987: * internals.texi (Stack-allocated Objects): Describe this feature.
Date: Tue, 30 Sep 2014 12:15:34 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

On 09/30/2014 10:55 AM, Stefan Monnier wrote:
I don't know C99 and I hence don't know
what is the "corresponding scope" of those new thingies.

I gave a shot at improving that part of the documentation in trunk bzr 117990.

See my other message about these macros.

Sorry, I don't remember which message that was?

I'd much prefer
declaration-level macros, which would come with clear scoping.

Although I can see the attraction of their clearer scoping, requiring a name for every temporary can make code considerably harder to read. 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);

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....)

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.)



reply via email to

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