From: "mame (Yusuke Endoh)" Date: 2012-07-23T23:21:37+09:00 Subject: [ruby-core:46658] [ruby-trunk - Feature #6361][Rejected] Bitwise string operations Issue #6361 has been updated by mame (Yusuke Endoh). Status changed from Feedback to Rejected Martin Bosslet and Joshua Ballanco, Sorry but this proposal was rejected at the developer meeting (7/21). Matz explicitly said he will not accept another class than String. He hates Python way. Two additional notes: * The original request (bitwise string operation) was not considered because it is not essential for ByteString; if you want, please file a new ticket for the specific feature with the detailed spec including corner cases (e.g., [ruby-core:44646]). * Matz wants to save the motivating example in the slide (below) in other approach than the proposal: "\xff".force_encoding("BINARY") << "\xff" #=> incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError) We discussed three approaches: 1. adding String#b that returns BINARY string: "\xff".force_encoding("BINARY") << "\xff".b 2. adding a new `percent' syntax for binary string: "\xff".force_encoding("BINARY") << %b{\xff} 3. suppressing the exception in some way Some people (including Matz) liked (3), but akr showed strong objection because it causes breaking a character (Sorry I didn't understand his opinion precisely). (2) is difficult because of syntax extension. So we are now keen on (1). This is discussed in #6767 (Sorry, in Japanese!) -- Yusuke Endoh ---------------------------------------- Feature #6361: Bitwise string operations https://bugs.ruby-lang.org/issues/6361#change-28324 Author: MartinBosslet (Martin Bosslet) Status: Rejected Priority: Normal Assignee: Category: core Target version: I know this has been discussed a lot in the past (and if there's still an open issue for this, I apologize, I couldn't find one), for example in [1]. While it is generally no problem to implement this on the fly, I still find that built-in support would be a real improvement. There are quite some use cases in cryptography where this would come in very handy, but I'm sure there are lots of other areas, too. While of course I understand the reasons that were given in the previous threads that ultimately lead to rejection, I still would like to reopen the discussion as I felt that in every thread so far the consensus was that having bitwise string operations would indeed be quite valuable. [1] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/34586 -- http://bugs.ruby-lang.org/