Implies operator
Mariano
rotoshi at yahoo.com
Thu Nov 16 03:46:08 PST 2006
== 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 → or ⇒!
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.
More information about the Digitalmars-d
mailing list