Implies operator

Rioshin an'Harthen rharth75 at hotmail.com
Wed Nov 15 01:49:21 PST 2006


"Roberto Mariottini" <rmariottini at mail.com> wrote:
> Hasan Aljudy wrote:
>> Mariano wrote:
>>>
>>> but the implication makes it far more clear for common day speach
>>>
>>>   if( check_boundaries -> a.length <= max_int )
>>>       process(a);
>>>
>>> makes more sence than
>>>
>>>   if( !check_boundaries || a.length <= max_int )
>>>       process(a);
>>
>> What does that mean? what's 'a' and what's 'check_boundaries'?
>
> You can view it as:
>
>   if( check_boundaries )
>     if( a.length <= max_int )
>       process(a);

Actually, no... that would be

    if ( check_boundaries && a.length <= max_int )

which is different. For the logical implication

    if ( !check_boundaries || a.length <= max_int )

the corresponding code would be

    if( check_boundaries )
    {
        if( a.length <= max_int )
            process(a);
    }
    else
        process(a);


But back to the proposal... I've had a few occasions where I've needed a 
logical implication; it's a pain to look up the corresponding and-or logic 
for it. However, I find the need for it to be so rare that including it in 
the language would make very little sense. 





More information about the Digitalmars-d mailing list