[#90865] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been reported by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90877] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been updated by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90895] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707)) — Eric Wong <normalperson@...>
ko1c-failure@atdot.net wrote:
4 messages
2019/01/05
[#90896] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707))
— Takashi Kokubun <takashikkbn@...>
2019/01/05
Thanks to explain that.
[#91200] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout — glass.saga@...
Issue #15553 has been reported by Glass_saga (Masaki Matsushita).
4 messages
2019/01/21
[#91289] Re: [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
— Eric Wong <normalperson@...>
2019/01/26
glass.saga@gmail.com wrote:
[ruby-core:91132] [Ruby trunk Feature#6801] String#~ for a here document
From:
eregontp@...
Date:
2019-01-16 20:49:11 UTC
List:
ruby-core #91132
Issue #6801 has been updated by Eregon (Benoit Daloze).
Target version deleted (Next Major)
Status changed from Assigned to Rejected
Indeed.
----------------------------------------
Feature #6801: String#~ for a here document
https://bugs.ruby-lang.org/issues/6801#change-76363
* Author: merborne (kyo endo)
* Status: Rejected
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
=begin
Let me propose a new method (({String#~})) for a here document.
次のような実装の(({String#~}))を提案します。
class String
def ~
margin = scan(/^ +/).map(&:size).min
gsub(/^ {#{margin}}/, '')
end
end
This is for removing leading margins of a here document.
これはヒアドキュメントにおける先頭マージンを除去するためのものです。
class ATool
def self.help
lines = ~<<-EOS
Instruction of `#{self}`
`#{self}` is one of a great tool in the world.
This helps you a lot on your daily work.
Your life will be changed with `#{self}`!!
Everyone knows about `#{self}`.
So, You can ask them to learn `#{self}`
Just Use `#{self}`
from Today!
EOS
lines
end
end
puts ATool.help
# >> Instruction of `ATool`
# >>
# >> `ATool` is one of a great tool in the world.
# >> This helps you a lot on your daily work.
# >> Your life will be changed with `ATool`!!
# >> Everyone knows about `ATool`.
# >> So, You can ask them to learn `ATool`
# >>
# >> Just Use `ATool`
# >>
# >> from Today!
you can put a tilde sign just before the "<<" characters to call String#~, just like putting a minus sign after "<<" to indent the terminator. This is achieved with uniqueness of tilde sign method, which takes the receiver object on the right-hand side.
If you define String#unindent for this purpose, you put `.unindent` after EOS. I think its less elegant than a tilde.
"<<"文字の直前にチルダを置くことで、String#~を呼び出すことができます。これはチルダ記号のメソッドが、そのレシーバオブジェクトを右側に取るという特徴によって実現されます。仮にこの目的のためにString#unindentを定義した場合は、EOSの後に`.unindent`を書くことになりますが、これはチルダに比べると美しくありません。
I understand that this is not general method for string but just for here document. However, I think using a tilde as a method is very restricted because it can't take parameters and is difficult to read the meanings or behavior from the sign. From this, there are few tilde methods within built-in classes of ruby inspite of its uniqness(only for Fixnum, Bignum and Regexp).
so, I think using tilde for the above purpose is the one of the few good chances.
Thank you for your consideration.
このメソッドがStringのための汎用的なものでなく、ヒアドキュメント専用であるということに問題がある点は理解しています。しかし、チルダをメソッドとして使える機会は、それが引数を取れないことと、その記号からはその意味や動作を察することは難しいことから、非常に限られていると想像します。故に、そのユニークさにも拘らず、Rubyの組み込みクラスでの使用例は少しです(Fixnum, BignumおよびRegexpでだけ)。
従って、上記目的でチルダを使うことは、数少ない良い機会であると考えます。
以上、ご検討のほどよろしくお願い致します。
This is based on the following my Japanese blog post.
((<URL:http://melborne.github.com/2012/04/27/ruby-heredoc-without-leading-whitespace/>))
=end
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>