ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "nobu (Nobuyoshi Nakada) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "nobu (Nobuyoshi Nakada)" <noreply@ruby-lang.org>
Subject: [ruby-core:119059] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s/to_str
Date: Thu, 05 Sep 2024 08:30:13 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-109637.20240905083012.48166@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-20703.20240827224658.48166@ruby-lang.org>

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/

  parent reply	other threads:[~2024-09-05  8:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-09-05  8:54 ` [ruby-core:119062] [Ruby master Feature#20703] Alias StringIO#string to StringIO#to_s/to_str matz (Yukihiro Matsumoto) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-109637.20240905083012.48166@ruby-lang.org \
    --to=ruby-core@ml.ruby-lang.org \
    --cc=noreply@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).