between and among: worth Phobosization? (reprise)

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 26 17:40:20 PDT 2015


On 3/26/15 4:03 PM, H. S. Teoh via Digitalmars-d wrote:
> On Thu, Mar 26, 2015 at 03:48:26PM -0700, Andrei Alexandrescu via Digitalmars-d wrote:
>> On 3/26/15 3:28 PM, H. S. Teoh via Digitalmars-d wrote:
>>> Don't like the name, though. Prefer 'isOrdered', otherwise it sounds
>>> like some kind of sorting algorithm (as in, returns an ordered
>>> sequence of its arguments).
>>
>> Must be single-word name or nothing per Andrei's Hierarchy Of Naming
>> Abstractions (AHONA). From low-level to high-level abstractions:
>>
>> * If a realization is too simple and frequent, no abstraction should
>> replace it.
>>
>> * If a realization has high frequency but low complexity, it can only
>> be replaced by an abstraction that is one simple word with no change
>> of case.  E.g. "among" is okay, "isAmong" is not.
>>
>> * If a realization has high frequency and high complexity, it may be
>> replaced by an abstraction with a multi-word name, little or no
>> nesting, and few or no type parameters.
>>
>> * If a realization has low frequency and high complexity, it may be
>> replaced by an abstraction with a multi-word name, nesting, and type
>> parameters.
> [...]
>
> If the bar is this high, then I vote against adding this function.
>
> Writing `if (0 <= x && x < 10)` is far easier and has a clear meaning,
> whereas hiding it behind a poorly-named one-word abstraction actually
> hurts readability and therefore maintainability. IMO this falls under
> the first rule you listed above.

https://github.com/D-Programming-Language/phobos/pull/3112 -- Andrei




More information about the Digitalmars-d mailing list