[ruby-core:113789] [Ruby master Feature#19718] Extend `-0` option

Issue #19718 has been reported by nobu (Nobuyoshi Nakada). ---------------------------------------- Feature #19718: Extend `-0` option https://bugs.ruby-lang.org/issues/19718 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal ---------------------------------------- Recently I learned that Perl's `-0` option is extended to accept a hexadecimal Unicode codepoint. However it uses `-0x`, and since `-x` is used for shebang and cd, it would cause a backward incompatibility if we will incorporate it as it is. So I propose that `-0uCODEPOINT` instead. This can be extended to comma- or colon-separated codepoint list. Also, another idea is `-0:sepaerator` which specifies the separator as-is. Considering many of modern shells provide escaped string form (e.g., `$'\uHHHH'), this may be a more modern answer, except for NUL cannot be represented. https://github.com/ruby/ruby/pull/7914 -- https://bugs.ruby-lang.org/

Issue #19718 has been updated by Dan0042 (Daniel DeLorme). It's a nifty idea, but `-0uCODEPOINT` means that the `-u` option is forever reserved for this usage which no one will ever really use I think, because `-0` is meant to be used like xargs `-0` option (ex: `find . -print0 | ruby -0ne 'p $_.chomp'`) and I can't imagine why anyone would use anything other than NUL. Although I would love to be shown wrong. `-0:separator` doesn't have that downside. ---------------------------------------- Feature #19718: Extend `-0` option https://bugs.ruby-lang.org/issues/19718#change-103438 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal ---------------------------------------- Recently I learned that Perl's `-0` option is extended to accept a hexadecimal Unicode codepoint. However it uses `-0x`, and since `-x` is used for shebang and cd, it would cause a backward incompatibility if we will incorporate it as it is. So I propose that `-0uCODEPOINT` instead. This can be extended to comma- or colon-separated codepoint list. Also, another idea is `-0:sepaerator` which specifies the separator as-is. Considering many of modern shells provide escaped string form (e.g., `$'\uHHHH'), this may be a more modern answer, except for NUL cannot be represented. https://github.com/ruby/ruby/pull/7914 -- https://bugs.ruby-lang.org/

Issue #19718 has been updated by nobu (Nobuyoshi Nakada). I thought the issue about `-u` is simply a matter of priorities; just the chance of `-0x` cannot be denied, but `-0u` should have never been used. But now I remembered `-U` has been implemented since 1.9. My patch allows `-0U` as well as `-0u`, and would need to change. Probably a punctuation (like as `:`) may be possible. ---------------------------------------- Feature #19718: Extend `-0` option https://bugs.ruby-lang.org/issues/19718#change-103440 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal ---------------------------------------- Recently I learned that Perl's `-0` option is extended to accept a hexadecimal Unicode codepoint. However it uses `-0x`, and since `-x` is used for shebang and cd, it would cause a backward incompatibility if we will incorporate it as it is. So I propose that `-0uCODEPOINT` instead. This can be extended to comma- or colon-separated codepoint list. Also, another idea is `-0:sepaerator` which specifies the separator as-is. Considering many of modern shells provide escaped string form (e.g., `$'\uHHHH'), this may be a more modern answer, except for NUL cannot be represented. https://github.com/ruby/ruby/pull/7914 -- https://bugs.ruby-lang.org/

Issue #19718 has been updated by Dan0042 (Daniel DeLorme). I meant it will not be possible to use `-u` in the future. With colon we could write anything after, like `-0:$'\t'` or `-0:011` or `-0:x09` or `-0:u0009` or `-0:b1001` 😃 Or use `=` instead of `:` ? Cheers. ---------------------------------------- Feature #19718: Extend `-0` option https://bugs.ruby-lang.org/issues/19718#change-103443 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal ---------------------------------------- Recently I learned that Perl's `-0` option is extended to accept a hexadecimal Unicode codepoint. However it uses `-0x`, and since `-x` is used for shebang and cd, it would cause a backward incompatibility if we will incorporate it as it is. So I propose that `-0uCODEPOINT` instead. This can be extended to comma- or colon-separated codepoint list. Also, another idea is `-0:sepaerator` which specifies the separator as-is. Considering many of modern shells provide escaped string form (e.g., `$'\uHHHH'), this may be a more modern answer, except for NUL cannot be represented. https://github.com/ruby/ruby/pull/7914 -- https://bugs.ruby-lang.org/

Issue #19718 has been updated by nobu (Nobuyoshi Nakada). Dan0042 (Daniel DeLorme) wrote in #note-3:
I meant it will not be possible to use `-u` in the future.
Yes, and I thought it wouldn’t be a problem, but might not be a good idea.
With colon we could write anything after, like `-0:$'\t'` or `-0:011` or `-0:x09` or `-0:u0009` or `-0:b1001` 😃 Or use `=` instead of `:` ?
`-0=$'\t'` and `-0:09`(= `-0:x09`)? ---------------------------------------- Feature #19718: Extend `-0` option https://bugs.ruby-lang.org/issues/19718#change-103444 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal ---------------------------------------- Recently I learned that Perl's `-0` option is extended to accept a hexadecimal Unicode codepoint. However it uses `-0x`, and since `-x` is used for shebang and cd, it would cause a backward incompatibility if we will incorporate it as it is. So I propose that `-0uCODEPOINT` instead. This can be extended to comma- or colon-separated codepoint list. Also, another idea is `-0:sepaerator` which specifies the separator as-is. Considering many of modern shells provide escaped string form (e.g., `$'\uHHHH'), this may be a more modern answer, except for NUL cannot be represented. https://github.com/ruby/ruby/pull/7914 -- https://bugs.ruby-lang.org/

Issue #19718 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected Very few users know the existence of `-0`. If we extend the option, probably no one uses the feature. Matz. ---------------------------------------- Feature #19718: Extend `-0` option https://bugs.ruby-lang.org/issues/19718#change-103459 * Author: nobu (Nobuyoshi Nakada) * Status: Rejected * Priority: Normal ---------------------------------------- Recently I learned that Perl's `-0` option is extended to accept a hexadecimal Unicode codepoint. However it uses `-0x`, and since `-x` is used for shebang and cd, it would cause a backward incompatibility if we will incorporate it as it is. So I propose that `-0uCODEPOINT` instead. This can be extended to comma- or colon-separated codepoint list. Also, another idea is `-0:sepaerator` which specifies the separator as-is. Considering many of modern shells provide escaped string form (e.g., `$'\uHHHH'), this may be a more modern answer, except for NUL cannot be represented. https://github.com/ruby/ruby/pull/7914 -- https://bugs.ruby-lang.org/
participants (3)
-
Dan0042 (Daniel DeLorme)
-
matz (Yukihiro Matsumoto)
-
nobu (Nobuyoshi Nakada)