Re: Improve readability by using designated initializers when possible

Поиск
Список
Период
Сортировка
От Jelte Fennema-Nio
Тема Re: Improve readability by using designated initializers when possible
Дата
Msg-id CAGECzQQpiR5QcAxxuSrzAcj_KyLbE=mfbgM3Sbs8g8-ET=PteA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Improve readability by using designated initializers when possible  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: Improve readability by using designated initializers when possible  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-hackers
On Thu, Feb 22, 2024, 23:46 Jeff Davis <pgsql@j-davis.com> wrote:

Am I missing something?

The main benefits it has are:
1. The order of the array doesn't have to exactly match the order of the enum for the arrays to contain the correct mapping. 
2. Typos in the enum variant names are caught by the compiler because actual symbols are used, not comments. 
3. The left-to-right order reads more natural imho for such key-value pairs, e.g. OCLASS_PROC maps to ProcedureRelationId. 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: bug report: some issues about pg_15_stable(8fa4a1ac61189efffb8b851ee77e1bc87360c445)
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Improve readability by using designated initializers when possible