Re: linked list rewrite

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: linked list rewrite
Date: 2004-03-23 18:16:51
Message-ID: 200403231816.i2NIGpp25485@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Neil Conway wrote:
> (1) API naming
>
> In the latest prototype implementation, I've adopted a completely new
> naming convention for the functions in the list API. The new API looks
> like:
>
> List *list_append(List *list, void *datum);
> List *list_prepend(List *list, void *datum);
> List *list_conc(List *list1, List *list2);
> bool list_member(List *list, void *datum);
> List *list_remove(List *list, void *datum);
> etc.
>
> Function variants which operate on integer lists (type = T_IntList)
> have an "_int" suffix, whereas OID list functions use an "_oid" suffix.
> By default, list operations use structural equality (i.e. equal()) --
> if a list function uses pointer equality to determine if two list
> elements are the same, it has the "_simple" suffix. And so on.
>
> In contrast, the existing List API is a lot more inconsistent (IMHO). I
> elaborated on some of the deficiencies of the existing API naming
> scheme here:
>
> http://archives.postgresql.org/pgsql-patches/2004-01/msg00188.php
>
> Tom objected to changing the names:
>
> http://archives.postgresql.org/pgsql-patches/2004-01/msg00186.php
> http://archives.postgresql.org/pgsql-patches/2004-01/msg00191.php

I agree a renaming of list functions is good. If we had kept the
original Berkeley code as-is, we would have a lot fewer developers
today. :-) Making drastic cleanups is often worthwile. I write
backend code and still can't remember which list function does what, so
clearer naming would help me a lot, and I am sure others too.

Tom had the idea of making compatible names for the old macros, and I
think that is an excellent compromise.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Hixson 2004-03-23 18:24:47 patterns for database administration
Previous Message Dustin Sallings 2004-03-23 17:18:11 Re: linked list rewrite

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-03-23 18:20:49 Re: [HACKERS] Two-phase commit
Previous Message Tom Lane 2004-03-23 18:06:43 Re: bug in 7.4 SET WITHOUT OIDs