From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_PASS,T_RP_MATCHES_RCVD shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 120041F404 for ; Sun, 4 Mar 2018 03:58:05 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id C56B5120908; Sun, 4 Mar 2018 12:58:01 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id D4BFD120906 for ; Sun, 4 Mar 2018 12:57:58 +0900 (JST) Received: by filter0019p3las1.sendgrid.net with SMTP id filter0019p3las1-14508-5A9B6EC3-20 2018-03-04 03:57:55.841556502 +0000 UTC Received: from herokuapp.com (ec2-54-211-8-62.compute-1.amazonaws.com [54.211.8.62]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id ayNPZeP8Q7mUP1upXtaJgg for ; Sun, 04 Mar 2018 03:57:55.685 +0000 (UTC) Date: Sun, 04 Mar 2018 03:57:56 +0000 (UTC) From: pumburu@ya.ru To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 61238 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 14574 X-Redmine-Issue-Author: pb X-Redmine-Sender: pb X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS5D/G/BN9+pwRJNSvSs3yILs7xJV404tos3aa kp8ZwlmzAXF8LTmiKDdDA8b0xqi+NBe5yOLc2QZ/a/wDbq7ILG8rrBBtqs84srgHm4SB+CblQXOazv s+o6/OELSYH0g1/zI/ZTIZXnSk8u6RjS3/Ll X-ML-Name: ruby-core X-Mail-Count: 85915 Subject: [ruby-core:85915] [Ruby trunk Feature#14574] percent literals and binary encoding strings X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #14574 has been updated by pb (pumbur _). oops. well, that certainly closes first part for me, the one that agitated me to write issue. there still was cases where i wanted to define other string literals, but i'm not sure its worth it. sorry for bothering, if no one has thoughts on second part, issue may be closed. ---------------------------------------- Feature #14574: percent literals and binary encoding strings https://bugs.ruby-lang.org/issues/14574#change-70771 * Author: pb (pumbur _) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- coding `"\x00".force_encoding('binary')` or `["\x00"].pack('a*')` is a hassle, is there a chance to have special percent literal for it? i.e: `%b"\x00"` would return binary string. (note, signle-character \x00 there is accidental, the idea is force any string from script encoding to binary) or, more general suggestion: allow percent literal with any [a-z] character, move all logic to user-level and allow it to be redefinable: ~~~ ruby define_percent_literal(:b){|q| q.force_encoding('binary') } %b'\x00' #=> "\x00" ~~~ -- https://bugs.ruby-lang.org/