From maechler at stat.math.ethz.ch  Thu Sep 28 10:17:04 2017
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Thu, 28 Sep 2017 10:17:04 +0200
Subject: [Rd] logic ops with zero-extent raw vectors
In-Reply-To: <F18AEA1F-3000-4FA7-9BA1-A5DC447500CC@oracle.com>
References: <F18AEA1F-3000-4FA7-9BA1-A5DC447500CC@oracle.com>
Message-ID: <22988.45056.833307.378675@stat.math.ethz.ch>

>>>>> Lukas Stadler <lukas.stadler at oracle.com>
>>>>>     on Wed, 27 Sep 2017 17:36:15 +0200 writes:

    > Hi,
    > there was a change concerning logical operations about a year ago:
    > https://github.com/wch/r-source/commit/9e19d3e3dd5f657b5cfefe562bdd7ede2e2b8786
    > It's related to a discussion on this list:
    > https://hypatia.math.ethz.ch/pipermail/r-devel/2016-September/073068.html <https://hypatia.math.ethz.ch/pipermail/r-devel/2016-September/073068.html>

    > A change in logic.c:134 influences the result type of operations on zero-extent raw vectors.
    > Old behavior:
    >> raw(1) & raw(1)
    > [1] 00
    >> raw(0) & raw(0)
    > raw(0)
    > New behavior:
    >> raw(1) & raw(1)
    > [1] 00
    >> raw(0) & raw(0)
    > logical(0)

    > I'm wondering whether the logical result type was intentional, because, to me, the old behavior seems more consistent.

Yes, logic operations on raw()s should remain raw() as always
documented.  Indeed, this is a bug introduced (to the source)
more than a year ago.  It is amazing that it had not been
noticed earlier.

Thank you, Lukas, for the report!

I'll fix it .. but of course too late for R version 3.4.2  which
has been released  about one hour ago (!).

Martin Maechler
ETH Zurich

    > Best,
    > Lukas
    > [[alternative HTML version deleted]]

    > ______________________________________________
    > R-devel at r-project.org mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] logic ops with zero-extent raw vectors
Martin Maechler