I will review
Lydia
On 07/02/2014 02:27 PM, Brad Chamberlain wrote:
This is a request for review:
Size of patch: 2 / 7
Level of difficulty: 1 / 7
As proposed yesterday, this patch adds support for logical negation
for int types. Since yesterday's mail, I've also added 'param'
overloads, tests to check the behavior, and documentation to the spec
(though I'm noting that the spec doesn't seem to document the param
versions of the ! operator and did not fix that here; instead, I added
a note to the TODO section, as I'm not sure what approach we want to
take for these cases).
A proposed commit message is just below.
Thanks,
-Brad
-----
Add support for logical negation of integral types
Prior to this patch, the ! operator was only supported for bool types.
This patch extends that support to also support integral types with
the obvious interpretation (zero => true, non-zero => false). This
implementation adds that support in both param and non-param versions.
It also adds a few tests to lock in the behavior and documentation to
the spec for the non-param versions (the existing param version did
not seem to be documented in the spec, so I followed suit here for
now, and added a TODO to the spec TODO to figure out how we want to
document these in the future).
I believe that the rationale for the past behavior has probably been
"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)
Proposing this on chapel-developers yesterday, there were no
objections, and more positive response than most requests for comment
generate.
------------------------------------------------------------------------------
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
------------------------------------------------------------------------------
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