lmi
[Top][All Lists]
Advanced

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

Re: [lmi] [lmi-commits] master 784ccff 1/4: Prefer 'n_'- prefix for "num


From: Greg Chicares
Subject: Re: [lmi] [lmi-commits] master 784ccff 1/4: Prefer 'n_'- prefix for "number of"
Date: Thu, 24 May 2018 01:18:03 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 2018-05-23 17:36, Vadim Zeitlin wrote:
> On Wed, 23 May 2018 12:25:26 -0400 (EDT) Greg Chicares <address@hidden> wrote:
> 
> GC> branch: master
> GC> commit 784ccfff8ff53f553715c59d37f29a26fb49965c
> GC> Author: Gregory W. Chicares <address@hidden>
> GC> Commit: Gregory W. Chicares <address@hidden>
> GC> 
> GC>     Prefer 'n_'- prefix for "number of"

[...i.e., s/\<num_/n_/ ...]

> I can, of course, see the gain of 2 characters, but can
> this be really the only thing?

Concinnity is the dominant concern. I've been using 'n_'- since forever.

If we want to refer to a vector with no concretely specified cardinality,
we say it has N elements {v0, v1, ... vN}. Using 'n_' as a snake-case
prefix indicating cardinality seems natural, and unambiguous--what else
could it possibly mean?

It might help to compile a lexicon. I was surprised when you recently
said that "pmt" wasn't obvious to you, because I've spent so many years
in the financial industry that it's easy to fall into the assumption
that everyone speaks the same jargon. Here are some old lists:

< dbnames.hpp sed -e'/lexicon/,/^$/!d' |less
< interest_rates.hpp sed -e'/Member names/,/^$/!d' |less

If I pronounce "sniffle", I mean the SNFL, not rhinorrhea.

> consider that "n_" prefix doesn't always mean "num_",

It does now...

> see e.g. "n_a" in
> ihs_avdebug.cpp, "n_d_c" in value_cast_test.cpp or the strings (!)
> "n_classes" and "n_cells" in multiple_cell_document.cpp.

...since commit f1a98e01. Thanks.

>  Is there any chance of reverting this change and, perhaps, doing the one
> in the other direction?

It's an arbitrary, dogmatic choice. I strongly prefer either severe
abbreviations, or none: hence, "CashSurrenderValue" or "CSV", but not
"CashSurrVal" or "CashSurValue" or "CshSrrndrVl". Thus, I don't mind
'number_of_'-, but if we're going to abbreviate it, 'N_of_' or 'num_'
aren't remotely as good IMO as 'n_'. As for commit 784ccff, I'd be
willing to change s/\<n_/number_of_/ instead--what do you think?
Well, actually, wait...

/opt/lmi/src/lmi[0]$git show --oneline --stat 784ccfff 
784ccfff Prefer 'n_'- prefix for "number of"
 group_quote_pdf_gen_wx.cpp |  4 ++--
 input_sequence_entry.cpp   |  4 ++--
 main_wx_test.cpp           |  4 ++--
 miscellany.cpp             | 10 +++++-----
 wx_table_generator.cpp     | 40 ++++++++++++++++++++--------------------
 wx_test_paste_census.cpp   |  8 ++++----
 6 files changed, 35 insertions(+), 35 deletions(-)

the changes in these files:

 input_sequence_entry.cpp   |  4 ++--
 main_wx_test.cpp           |  4 ++--
 wx_test_paste_census.cpp   |  8 ++++----

have already been optimized away by commit 75c69c6a, leaving only:

 group_quote_pdf_gen_wx.cpp |  4 ++--
 miscellany.cpp             | 10 +++++-----
 wx_table_generator.cpp     | 40 ++++++++++++++++++++--------------------

and I'll push a change to the first of those three momentarily, so
the question is only whether we want 'number_of_' in the others.
I'll just make it so and push everything.



reply via email to

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