On Thu, Dec 19, 2002 at 09:54:03PM +0900, nobu.nokada / softhome.net wrote:
> At Thu, 19 Dec 2002 20:25:01 +0900,
> Alexander Bokovoy wrote:
> > It seems that there is a bug in recent sprintf changes which presents at least in 
> > a snapshot of Ruby 1.7.3 dated 2002-11-17:
> > 
> > $ irb
> > irb(main):001:0> sprintf("%*s", 10, "hello")
> > "     hello"
> > irb(main):002:0> sprintf("%*1$s", 10, "hello")
> > ArgumentError: unnumbered(1) mixed with numbered
> > 	from (irb):2:in `sprintf'
> >         from (irb):2
> > irb(main):003:0> sprintf("%*2$s", "hello", 10)
> > ArgumentError: unnumbered(1) mixed with numbered
> >         from (irb):3:in `sprintf'
> >         from (irb):3
> 
> sprintf("%*1$2$s", 10, "hello")	# => "     hello"
> sprintf("%2$*1$s", 10, "hello") # => "     hello"
Ok, it works now. I'm updating ProgrammingRuby sources to produce
something compileable with Ruby 1.7.3 and this was one of few bugs in book
code keeping away successful compilation.

Thank you!

-- 
/ Alexander Bokovoy
---
"Is it really you, Fuzz, or is it Memorex, or is it radiation sickness?" 
-- Sonic Disruptors comics