* [ruby-core:118970] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s
@ 2024-08-27 22:46 sebyx07 (Sebastian Buza) via ruby-core
2024-08-28 1:19 ` [ruby-core:118971] " Dan0042 (Daniel DeLorme) via ruby-core
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: sebyx07 (Sebastian Buza) via ruby-core @ 2024-08-27 22:46 UTC (permalink / raw)
To: ruby-core; +Cc: sebyx07 (Sebastian Buza)
Issue #20703 has been reported by sebyx07 (Sebastian Buza).
----------------------------------------
Feature #20703: Alias StringIO#string to StringIO#to_s
https://bugs.ruby-lang.org/issues/20703
* Author: sebyx07 (Sebastian Buza)
* Status: Open
----------------------------------------
# Description
Allow to use `StringIO.new('my string').to_s` to be the same as `StringIO.new('my string').string`
IMO nobody really uses the current StringIO#to_s, so I don't think it will break other apps.
That way you can also do interpolation easily
```ruby
my_sio = StringIO.new('my string')
puts "value: #{my_sio}" # value: my string
```
- issue: https://github.com/ruby/stringio/issues
- pr: https://github.com/ruby/stringio/pull/103
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:118971] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s
2024-08-27 22:46 [ruby-core:118970] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s sebyx07 (Sebastian Buza) via ruby-core
@ 2024-08-28 1:19 ` Dan0042 (Daniel DeLorme) via ruby-core
2024-08-28 12:24 ` [ruby-core:118977] " sebyx07 (Sebastian Buza) via ruby-core
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Dan0042 (Daniel DeLorme) via ruby-core @ 2024-08-28 1:19 UTC (permalink / raw)
To: ruby-core; +Cc: Dan0042 (Daniel DeLorme)
Issue #20703 has been updated by Dan0042 (Daniel DeLorme).
+1
Might also consider adding #to_str, as I think it makes sense to consider StringIO to be a kind of string.
----------------------------------------
Feature #20703: Alias StringIO#string to StringIO#to_s
https://bugs.ruby-lang.org/issues/20703#change-109544
* Author: sebyx07 (Sebastian Buza)
* Status: Open
----------------------------------------
# Description
Allow to use `StringIO.new('my string').to_s` to be the same as `StringIO.new('my string').string`
IMO nobody really uses the current StringIO#to_s, so I don't think it will break other apps.
That way you can also do interpolation easily
```ruby
my_sio = StringIO.new('my string')
# current
puts "value: #{my_sio}" # value: #<StringIO:0x0000764bba88eec0>
# after
puts "value: #{my_sio}" # value: my string
```
- issue: https://github.com/ruby/stringio/issues/102
- pr: https://github.com/ruby/stringio/pull/103
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:118977] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s
2024-08-27 22:46 [ruby-core:118970] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s sebyx07 (Sebastian Buza) via ruby-core
2024-08-28 1:19 ` [ruby-core:118971] " Dan0042 (Daniel DeLorme) via ruby-core
@ 2024-08-28 12:24 ` sebyx07 (Sebastian Buza) via ruby-core
2024-09-05 8:30 ` [ruby-core:119059] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s/to_str nobu (Nobuyoshi Nakada) via ruby-core
2024-09-05 8:54 ` [ruby-core:119062] " matz (Yukihiro Matsumoto) via ruby-core
3 siblings, 0 replies; 5+ messages in thread
From: sebyx07 (Sebastian Buza) via ruby-core @ 2024-08-28 12:24 UTC (permalink / raw)
To: ruby-core; +Cc: sebyx07 (Sebastian Buza)
Issue #20703 has been updated by sebyx07 (Sebastian Buza).
@Dan0042 done, ty!
----------------------------------------
Feature #20703: Alias StringIO#string to StringIO#to_s
https://bugs.ruby-lang.org/issues/20703#change-109549
* Author: sebyx07 (Sebastian Buza)
* Status: Open
----------------------------------------
# Description
Allow to use `StringIO.new('my string').to_s` to be the same as `StringIO.new('my string').string`
IMO nobody really uses the current StringIO#to_s, so I don't think it will break other apps.
That way you can also do interpolation easily
```ruby
my_sio = StringIO.new('my string')
# current
puts "value: #{my_sio}" # value: #<StringIO:0x0000764bba88eec0>
# after
puts "value: #{my_sio}" # value: my string
```
- issue: https://github.com/ruby/stringio/issues/102
- pr: https://github.com/ruby/stringio/pull/103
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:119059] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s/to_str
2024-08-27 22:46 [ruby-core:118970] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s sebyx07 (Sebastian Buza) via ruby-core
2024-08-28 1:19 ` [ruby-core:118971] " Dan0042 (Daniel DeLorme) via ruby-core
2024-08-28 12:24 ` [ruby-core:118977] " sebyx07 (Sebastian Buza) via ruby-core
@ 2024-09-05 8:30 ` nobu (Nobuyoshi Nakada) via ruby-core
2024-09-05 8:54 ` [ruby-core:119062] " matz (Yukihiro Matsumoto) via ruby-core
3 siblings, 0 replies; 5+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-09-05 8:30 UTC (permalink / raw)
To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)
Issue #20703 has been updated by nobu (Nobuyoshi Nakada).
Status changed from Open to Rejected
At this developers' meeting, no one was favor of this.
IMO, `StringIO` is not a `String`-like object.
----------------------------------------
Feature #20703: Alias StringIO#string to StringIO#to_s/to_str
https://bugs.ruby-lang.org/issues/20703#change-109637
* Author: sebyx07 (Sebastian Buza)
* Status: Rejected
----------------------------------------
# Description
Allow to use `StringIO.new('my string').to_s` to be the same as `StringIO.new('my string').string`
IMO nobody really uses the current StringIO#to_s, so I don't think it will break other apps.
* Also added .to_str
That way you can also do interpolation easily
```ruby
my_sio = StringIO.new('my string')
# current
puts "value: #{my_sio}" # value: #<StringIO:0x0000764bba88eec0>
# after
puts "value: #{my_sio}" # value: my string
```
- issue: https://github.com/ruby/stringio/issues/102
- pr: https://github.com/ruby/stringio/pull/103
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:119062] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s/to_str
2024-08-27 22:46 [ruby-core:118970] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s sebyx07 (Sebastian Buza) via ruby-core
` (2 preceding siblings ...)
2024-09-05 8:30 ` [ruby-core:119059] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s/to_str nobu (Nobuyoshi Nakada) via ruby-core
@ 2024-09-05 8:54 ` matz (Yukihiro Matsumoto) via ruby-core
3 siblings, 0 replies; 5+ messages in thread
From: matz (Yukihiro Matsumoto) via ruby-core @ 2024-09-05 8:54 UTC (permalink / raw)
To: ruby-core; +Cc: matz (Yukihiro Matsumoto)
Issue #20703 has been updated by matz (Yukihiro Matsumoto).
Since `StringIO` is a IO-like object, not String-like object, so it should not provide `to_str`. And string body of a StringIO tends to be long, so simple alias of `string` to `to_s` does not always work well.
So please use `string` method if you want string body from a StringIO.
Matz.
----------------------------------------
Feature #20703: Alias StringIO#string to StringIO#to_s/to_str
https://bugs.ruby-lang.org/issues/20703#change-109640
* Author: sebyx07 (Sebastian Buza)
* Status: Rejected
----------------------------------------
# Description
Allow to use `StringIO.new('my string').to_s` to be the same as `StringIO.new('my string').string`
IMO nobody really uses the current StringIO#to_s, so I don't think it will break other apps.
* Also added .to_str
That way you can also do interpolation easily
```ruby
my_sio = StringIO.new('my string')
# current
puts "value: #{my_sio}" # value: #<StringIO:0x0000764bba88eec0>
# after
puts "value: #{my_sio}" # value: my string
```
- issue: https://github.com/ruby/stringio/issues/102
- pr: https://github.com/ruby/stringio/pull/103
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-05 8:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-27 22:46 [ruby-core:118970] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s sebyx07 (Sebastian Buza) via ruby-core
2024-08-28 1:19 ` [ruby-core:118971] " Dan0042 (Daniel DeLorme) via ruby-core
2024-08-28 12:24 ` [ruby-core:118977] " sebyx07 (Sebastian Buza) via ruby-core
2024-09-05 8:30 ` [ruby-core:119059] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s/to_str nobu (Nobuyoshi Nakada) via ruby-core
2024-09-05 8:54 ` [ruby-core:119062] " matz (Yukihiro Matsumoto) via ruby-core
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).