From: "Earlopain (Earlopain _) via ruby-core" Date: 2026-11-25T07:54:07+00:00 Subject: [ruby-core:127708] [Ruby Feature#5558] String#% strange arity errors Issue #5558 has been updated by Earlopain (Earlopain _). Status changed from Assigned to Closed Fixed by https://bugs.ruby-lang.org/issues/22136 ---------------------------------------- Feature #5558: String#% strange arity errors https://bugs.ruby-lang.org/issues/5558#change-120227 * Author: trans (Thomas Sawyer) * Status: Closed * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- When the number of arguments do not match the number of % parameters, the String#% method has some odd behavior. When too many, it seems to work fine, ignoring the extra arguments. "%s" % [1,2] #=> "1" But if `$DEBUG = true`, "%s" % [1,2] #=> ArgumentError: too many arguments for format string That doesn't seem right. Is it an error or isn't it? For too few arguments it is always an error: "%s" % [] #=> ArgumentError: too few arguments Personally, I think it should use '' for missing arguments. That would make it more flexible in practice. I consider the first $DEBUG issue a bug, and the later a feature. But I'll just call it a feature altogether to make things easier. -- 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/