From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r117987: * internals.texi (Stack-allocated Objects): Describe this feature. Date: Tue, 30 Sep 2014 16:20:01 -0400 Message-ID: References: <542B0156.1040001@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1412108460 22680 80.91.229.3 (30 Sep 2014 20:21:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Sep 2014 20:21:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 30 22:20:53 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XZ3uk-0007oR-O8 for ged-emacs-devel@m.gmane.org; Tue, 30 Sep 2014 22:20:50 +0200 Original-Received: from localhost ([::1]:45910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZ3uk-0006Uv-AX for ged-emacs-devel@m.gmane.org; Tue, 30 Sep 2014 16:20:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZ3u6-0006Nx-G6 for emacs-devel@gnu.org; Tue, 30 Sep 2014 16:20:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XZ3tz-0002Eu-0I for emacs-devel@gnu.org; Tue, 30 Sep 2014 16:20:10 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:48017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZ3ty-0002Dm-Sf for emacs-devel@gnu.org; Tue, 30 Sep 2014 16:20:02 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZDoJ4g0rAPYEXF3SCJQEBAQECAVYjBQsLNBIUGA0kiAQI0hkXjnoHhDgEqRmBaoFxf1wh X-IPAS-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZDoJ4g0rAPYEXF3SCJQEBAQECAVYjBQsLNBIUGA0kiAQI0hkXjnoHhDgEqRmBaoFxf1wh X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="91324460" Original-Received: from 69-196-168-232.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.232]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Sep 2014 16:20:02 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id DAE137CD1; Tue, 30 Sep 2014 16:20:01 -0400 (EDT) In-Reply-To: <542B0156.1040001@cs.ucla.edu> (Paul Eggert's message of "Tue, 30 Sep 2014 12:15:34 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:174892 Archived-At: > 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