Implies operator

Kristian Kilpi kjkilpi at gmail.com
Thu Nov 16 07:06:35 PST 2006


On Thu, 16 Nov 2006 13:46:08 +0200, Mariano <rotoshi at yahoo.com> wrote:

> == Quote from Stewart Gordon (smjg_1998 at yahoo.com)'s article
>> Hasan Aljudy wrote:
>> > Mariano wrote:
>> <snip>
>> >> 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);
>> </snip>
>> What this notation is saying is: If check_boundaries is true, then we
>> need to check whether a.length <= max_int - otherwise we needn't bother.
>> But still, it isn't exactly the clearest notation.
> Yes, it was just an example out of the blue. I think it is clearer, and  
> I can't think of a better way.
>
>> <snip>
>> > Yea, it's easy, sure .. but -> has another totally different meaning  
>> in
>> > C++. Not that I care about C++ anymore, but D, being a C-family
>> > language, IMHO, shouldn't do this.
>> <snip>
>
> The notation was just a suggestion. I would prefer =>, but it might be  
> confused with >=. Other options are
> ==>, -->, and since we have UTF-8 support, why not &#8594; or &#8658;!
>
> I understand most people don't have the notion of 'implicance' so fresh  
> in their heads as with other logical
> operators, but I believe this is a consecuence of the imposed operators  
> by languages. Having an extra logical
> operator would give an edge for the programmer used to it, and won't  
> hurt the one who doesn't whant to use it.
>
> What's more, this operator is far more coherent with the behaviour of  
> not revising the second condition if not
> needed.
>
> Who knows, if implemented, it might even become widely used one day.
>
> Mariano.

I haven't used implication anywhere; I'm not 'able' to think x implies y.  
But that's probably because there is no implication operator.

Now when I think about it, I have to say that 'x implies y' is a lot  
easier to understand than '!x || y'.

I cannot say how much I would use it, if there was one. (I'm still not  
used to such an operator.)



More information about the Digitalmars-d mailing list