"itsme213" <itsme213 / hotmail.com> schrieb im Newsbeitrag news:PQkrd.64867$g21.12722 / fe1.texas.rr.com... > > You can view "x" as an object constructor (much similar to 1, [] {1=>2} > > etc.). Different from 1 "x" creates new instances every time it is > > executed: > > That explains why a) it doesn't make sense to do 'def "x".foo()...end' > > (regardless of the number of brackets around "x") and b) Ruby issues the > > warning / error message. > > I'm sure I am missing something. > > a = "x" > def a.foo; end > b = a > b.foo > > Have I not defined a singleton method on a literal? You have not. You defined a singleton method on a string instance that represents the sequence "x". If you like you can view it that way that the literal "x" is not directly accessible. It just creates a string instance with sequence "x" every time it is evaluated: 15:51:21 [c]: ruby -e '10.times { p "x".id }' 134690524 134690500 134690476 134690452 134690428 134690404 134690380 134690356 134690332 134690308 Kind regards robert