develooper Front page | perl.perl5.porters | Postings from December 2015

Re: RFC: what to do about bitwise string operators (related to [perl#63574])

Thread Previous | Thread Next
From:
Father Chrysostomos
Date:
December 15, 2015 04:14
Subject:
Re: RFC: what to do about bitwise string operators (related to [perl#63574])
Message ID:
B283CAE9-7475-4E1B-8C0B-2C4B1D8B306A@cpan.org

On Dec 14, 2015, at 6:05 PM, Karl Williamson <public@khwilliamson.com> wrote:

> On 11/18/2015 08:37 PM, Ricardo Signes wrote:
>> * Karl Williamson <public@khwilliamson.com> [2015-11-16T21:57:35]
>>> I still don't think [operating bitwise on codepoints in character strings] is
>>> useful in general.  Code points are not generally assigned where the
>>> relationship between them is meaningful in bit operations ways.
>> 
>> Agreed.  Although there are a few use cases that were pointed out, I think we
>> need to decide what the behavior of &. on strings is and be consistent.  I
>> still think the correct thing to do is assert that the arguments to &. are
>> treated as, and must plausibly be, byte strings.
>> 
>> It shouldn't matter whether the string is upgraded or not, as it's too easy to
>> end up with bytes in an upgraded string or codepoints in a downgraded string.
>> No Unicode Bug!
>> 
> 
> Ok.  I'd like ideas on how to word the deprecation message that gets raised.  I don't like what I've come up with:
> 
> "It is deprecated to '%s' a string containing non-byte data",
> 
> where %s is PL_op_name[PL_op->op_type]);
> 
> I don't like it because it uses the passive voice, but more importantly, the name becomes something like 'bit_xor', which I don't
> think will necessarily make sense to the reader.
> 
> So, any ideas?

PL_op_desc, not PL_op_name, and use ‘on’:

"%s on a string containing non-byte data is deprecated"

But then that becomes: bitwise xor (^) on a string containing non-byte data is deprecated at -e line 1.

Ouch.  We really should capitalize it.  I would suggest memcpying the name into a small auto buffer, capitalizing the first letter, and then emitting the warning, all if PL_ck_warn of course.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About