Final by default?

Regan Heath regan at netmail.co.nz
Fri Mar 14 06:21:54 PDT 2014


On Fri, 14 Mar 2014 10:22:40 -0000, 1100110 <0b1100110 at gmail.com> wrote:

> On 3/14/14, 4:58, Regan Heath wrote:
>>
>> Maintenance is very slightly better too, IMO, because you
>> add/remove/alter a complete line rather than editing a set of || && etc
>> which can in some cases be a little confusing.  Basically, the chance of
>> an error is very slightly lower.
>>
>> For example, either this:
>>
>> version(X86) version = MeaningfulVersion
>> version(X86_64) version = MeaningfulVersion
>> version(PPC) version = MeaningfulVersion
>> version(PPC64) version = MeaningfulVersion
>> version(ARM) version = MeaningfulVersion
>> version(AArch64) version = MeaningfulVersion
>>
>> version(MeaningfulVersion)
>> {
>> }
>> else version (MIPS32)
>> {
>> }
>>
>> or this:
>>
>> version (X86) version = MeaningfulVersion
>> version (X86_64) version = MeaningfulVersion
>> version (PPC) version = MeaningfulVersion
>> version (PPC64) version = MeaningfulVersion
>> version (ARM) version = MeaningfulVersion
>> version (AArch64) version = MeaningfulVersion
>>
>> version (MIPS32) version = OtherMeaningfulVersion
>>
>> version (MeaningfulVersion)
>> {
>> }
>> else version (OtherMeaningfulVersion)
>> {
>> }
>>
>> Regan
>>
>
>
> ...I can't even begin to describe how much more readable the OR'd  
> version is.

It's shorter, but shorter does not mean more "readable".. if by readable  
you mean include the ability to communicate intent etc.  Add to that, that  
readable is just one metric.

Walter's point is that the above pattern is better at communicating  
intent, clarifying your logic, and making the resulting version statements  
easier to understand (aka "more readable")

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list