From: Pedro Alves <palves@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>,
Jonathan Wakely <jwakely@redhat.com>
Cc: tbsaunde+gcc@tbsaunde.org, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 0/2] add unique_ptr class
Date: Mon, 04 Sep 2017 10:05:00 -0000 [thread overview]
Message-ID: <f4dbbcbc-aac7-5d0a-0595-7d2f419c2965@redhat.com> (raw)
In-Reply-To: <CAFiYyc1G8ybwsEGKQ-THUoxqUaH0PZfZzmBs42twfKu2gr6xsw@mail.gmail.com>
On 09/04/2017 11:31 AM, Richard Biener wrote:
> On Fri, Aug 11, 2017 at 10:43 PM, Jonathan Wakely <jwakely@redhat.com> wrote:
>> On 05/08/17 20:05 +0100, Pedro Alves wrote:
>>>
>>> On 08/04/2017 07:52 PM, Jonathan Wakely wrote:
>>>>
>>>> On 31/07/17 19:46 -0400, tbsaunde+gcc@tbsaunde.org wrote:
>>>>>
>>>>> I've been saying I'd do this for a long time, but I'm finally getting to
>>>>> importing the C++98 compatable unique_ptr class Pedro wrote for gdb a
>>>>> while
>>>>> back.
>>>
>>>
>>> Thanks a lot for doing this!
>>>
>>>> I believe the gtl namespace also comes from Pedro, but GNU template
>>>> library seems as reasonable as any other name I can come up with.
>>>
>>>
>>> Yes, I had suggested it here:
>>>
>>> https://sourceware.org/ml/gdb-patches/2017-02/msg00197.html
>>>
>>>>
>>>> If it's inspired by "STL" then can we call it something else?
>>>>
>>>> std::unique_ptr is not part of the STL, because the STL is a library
>>>> of containers and algorithms from the 1990s. std::unique_ptr is
>>>> something much newer that doesn't originate in the STL.
>>>>
>>>> STL != C++ Standard Library
>>>
>>>
>>> That I knew, but gtl was not really a reference to the
>>> C++ Standard Library, so I don't see the problem. It was supposed to
>>> be the name of a library which would contain other C++ utilities
>>> that would be shared by different GNU toolchain components.
>>> Some of those bits would be inspired by, or be straight backports of
>>> more-recent standards, but it'd be more than that.
>>>
>>> An option would be to keep "gtl" as acronym, but expand it
>>> to "GNU Toolchain Library" instead.
>>
>>
>> OK, that raises my hackles less. What bothered me was an apparent
>> analogy to "STL" when that isn't even the right name for the library
>> that provides the original unique_ptr.
>>
>> And "template library" assumes we'd never add non-templates to it,
>> which is unlikely (you already mentioned offset_type, which isn't a
>> template).
>>
>> It seems odd to make up a completely new acronym for this though,
>> rather than naming it after something that exists already in the
>> toolchain codebases.
>>
>>
>>> For example, gdb has been growing C++ utilities under gdb/common/
>>> that might be handy for gcc and other projects too, for example:
>>>
>>> - enum_flags (type-safe enum bit flags)
>>> - function_view (non-owning reference to callables)
>>> - offset_type (type safe / distinct integer types to represent offsets
>>> into anything addressable)
>>> - optional (C++11 backport of libstdc++'s std::optional)
>>> - refcounted_object.h (intrusively-refcounted types)
>>> - scoped_restore (RAII save/restore of globals)
>>> - an allocator that default-constructs using default-initialization
>>> instead of value-initialization.
>>>
>>> and more.
>>>
>>> GCC OTOH has code that might be handy for GDB as well, like for
>>> example the open addressing hash tables (hash_map/hash_table/hash_set
>>> etc.).
>>>
>>> Maybe Gold could make use of some of this code too. There
>>> are some bits in Gold that might be useful for (at least) GDB
>>> too. For example, its Stringpool class.
>>>
>>> I think there's a lot of scope for sharing more code between the
>>> different components of the GNU toolchain, even beyond general
>>> random utilities and data structures, and I'd love to see us
>>> move more in that direction.
>>>
>>>> If we want a namespace for GNU utilities, what's wrong with "gnu"?
>>>
>>>
>>> That'd be an "obvious" choice, and I'm not terribly against it,
>>> though I wonder whether it'd be taking over a name that has a wider
>>> scope than intended? I.e., GNU is a larger set of projects than the
>>> GNU toolchain. For example, there's Gnulib, which already compiles
>>> as libgnu.a / -lgnu, which might be confusing. GCC doesn't currently
>>> use Gnulib, but GDB does, and, there was work going on a while ago to
>>> make GCC use gnulib as well.
>>
>>
>> Good point. "gnutools" might be more accurate, but people might object
>> to adding 10 extra characters for "gnutools::".
>>
>> Naming is important, especially for a whole namespace (not just a
>> single type) so I do think it's worth spending time getting it right.
>>
>> But I could live with gtl as long as nobody ever says "GTL is the GNU
>> STL" or mentions "gtl" and STL in the same breath :-)
>
> If it should be short use g::. We can also use gnu:: I guess and I
> agree gnutools:: is a little long (similar to libiberty::). Maybe
> gt:: as a short-hand for gnutools.
Exactly 3 letters has the nice property of making s/gtl::foo/std::foo/ super
trivial down the road; you don't have to care about reindenting stuff
[1]. Also makes gdb->gtl and gcc->gtl renamings trivial in the same way.
Really a minor thing in the grand scheme of things, but just a FYI that that
factored in a bit in the original motivation for the "gtl" naming back when
I proposed it on the gdb list.
[1] - [PATCH] gdb::{unique_ptr,move} -> std::{unique_ptr,move}:
https://sourceware.org/ml/gdb-patches/2016-11/msg00200.html
Thanks,
Pedro Alves
next prev parent reply other threads:[~2017-09-04 10:05 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-31 23:46 tbsaunde+gcc
2017-07-31 23:46 ` [PATCH 2/2] use unique_ptr some tbsaunde+gcc
2017-07-31 23:46 ` [PATCH 1/2] add unique_ptr header tbsaunde+gcc
2017-08-01 14:40 ` David Malcolm
2017-08-02 3:09 ` Trevor Saunders
2017-08-04 19:55 ` Jonathan Wakely
2017-08-05 5:39 ` Trevor Saunders
2017-10-11 18:52 ` David Malcolm
2017-10-12 14:08 ` Trevor Saunders
2017-10-13 3:05 ` [PATCH] Add gnu::unique_ptr David Malcolm
2017-10-13 9:36 ` Richard Biener
2017-10-13 12:08 ` Pedro Alves
2017-10-14 0:35 ` [PATCH] Implement unique_xmalloc_ptr<T[]> and add more selftests David Malcolm
2017-10-16 10:53 ` Pedro Alves
2017-10-16 21:04 ` [committed] Add gnu::unique_ptr David Malcolm
2017-10-19 17:27 ` Gerald Pfeifer
2017-10-19 17:41 ` David Malcolm
2017-10-22 11:40 ` Gerald Pfeifer
2017-08-02 8:14 ` [PATCH 1/2] add unique_ptr header Richard Biener
2017-08-01 0:51 ` [PATCH 0/2] add unique_ptr class David Malcolm
2017-08-04 18:52 ` Jonathan Wakely
2017-08-05 5:36 ` Trevor Saunders
2017-08-07 13:01 ` Jonathan Wakely
2017-08-05 19:05 ` Pedro Alves
2017-08-11 21:30 ` Jonathan Wakely
2017-09-03 1:24 ` Trevor Saunders
2017-09-04 9:31 ` Richard Biener
2017-09-04 10:05 ` Pedro Alves [this message]
2017-09-05 16:52 ` Manuel López-Ibáñez
2017-09-05 17:40 ` Pedro Alves
2017-09-06 12:35 ` replace libiberty with gnulib (was: Re: [PATCH 0/2] add unique_ptr class) Manuel López-Ibáñez
2017-08-04 22:43 ` [PATCH 0/2] add unique_ptr class Martin Sebor
2017-08-05 5:32 ` Trevor Saunders
2017-08-14 8:26 Ville Voutilainen
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=f4dbbcbc-aac7-5d0a-0595-7d2f419c2965@redhat.com \
--to=palves@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jwakely@redhat.com \
--cc=richard.guenther@gmail.com \
--cc=tbsaunde+gcc@tbsaunde.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.
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).