On Wednesday, 15 June 2016 at 03:42:52 UTC, Walter Bright wrote:
On 6/14/2016 8:15 PM, tsbockman wrote:
Do I really need to give it some giant multi-word name?

Something better than 'N'.

`Int`? `Base`?

Whatever it is needs to be short; `BaseIntegralType` is *way* too long for this and would make many of the signatures painfully verbose.

Besides which, Phobos uses single-letter names for template parameter type names
all over the place.

Generally 'T' is used for 'any type'. 'N' has no corresponding significance.

I have seen all of `S`, `F`, `G`, `X`, `R`, `C`, `A`, and `B` used as template parameter names in Phobos. Often there is no particular significance to the letter chosen, but the purpose of the parameter is obvious from the context, anyway.

Using short template parameter names helps keep D's already-very-long signatures from growing even longer than they already are.

Greppability is inddeed a plus, but 'bscal' is needlessly uninformative. Note that publicly facing names should not be so.

`basic`? `base`?

Again, this needs to be short for readability and usability. Normally it's not needed at all, but when it is needed (like in the implementation of `SmartInt` and `SafeInt`), it tends to be needed *a lot*.

The obvious choices - `value`, `val`, or `raw` - are out because of the shadowing problem.

I will work on the docs some more.

Thank you.


* SmartInt.toString(sink, fmt)
* SafeInt.toString(sink, fmt)
* checkedint.to()
* IntFlag.toString(sink, fmt)
* IntFlags.toString(sink, fmt)

I see no love for output ranges :-(

I will add support. Someone should update this wiki page with whatever the current best practice is:
    http://wiki.dlang.org/Defining_custom_print_format_specifiers

Reply via email to