Issue #512 has been updated by Yusuke Endoh.

Status changed from Assigned to Rejected

Hello,

I'm rejecting this feature ticket because no progress has been made
for a long time.  See [ruby-core:42391].



The following is *just my personal comment*.

An implementation detail is an implementation detail, even if it
affects user code.

> class A
>   def to_s; "Hello"; end
>   def to_ary; ["Goodbye"]; end
> end
>
> puts sprintf("%s", A.new) #=> Hello
> puts "%s" % A.new         #=> Goodbye

This comparison does not make sense because this compares different
things.

> puts sprintf("%s", A.new) #=> Hello
> puts "%s" % [A.new]       #=> Hello

There is nothing strange.
Do you complain the following behavior, too?

> sprintf("%d %d", 1, 2) #=> "1 2"
> "%d %d".%(1, 2)        #=> wrong number of arguments(2 for 1)

-- 
Yusuke Endoh <mame / tsg.ne.jp>
----------------------------------------
Feature #512: String#% behavior
https://bugs.ruby-lang.org/issues/512

Author: Federico Builes
Status: Rejected
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: core
Target version: 2.0.0


=begin
 Right now String#%  is calling #to_ary on the its arguments for every case. Should it call it on cases where it only receives one argument?
 
 Example:
 
 
     "%c" % 65   # the call's not really necessary but it's done here.
 
 
 We'd like to have this clarified for Rubyspec and for Rubinius. 
 Thanks
=end



-- 
http://bugs.ruby-lang.org/