Hi Chapel Developers --

This is a check to see whether people think that Chapel should support ! 
(logical negation) on integral (int(*), uint(*)) values by default. 
Today, Chapel supports it on booleans only.

I believe that the rationale for the current behavior is probably "it's 
what C# does."  I believe C#'s rationale is to avoid making typos like the 
following legal programs:

        if (!(x=5)) ...

where the user probably meant to type:

        if (!(x==5)) ...

Chapel prevents these typos another way -- by only permitting assignments 
at the statement level, so that may be a reason to feel OK diverging from 
C#'s practice.


Note that Chapel does permit integer expressions in conditionals, e.g.:

        var x: int;
        ...

        if (x) ...

which is why it seemed suprising to me to find that we do not support:

        if (!x)



Adding the following two overloads to ChapelBase seems to cause no new 
failures in testing:

        inline proc !(a: int(?w)) return (a == 0);
        inline proc !(a: uint(?w)) return (a == 0);

So the question is: Should we add them?


Thanks,
-Brad


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to