From: Christoph Rippel Date: 2000-11-23T09:42:05+09:00 Subject: [ruby-talk:6538] Re: Question about the behavior of write attributes in blocks I lifted the following two lines from your (great) book - Page 285 ************ a = ["a","b","c","d"]. a.collect! {|x| x+"!"} p a ************* which has the output >> undefined method `a' for ["a", "b", "c", "d"]:Array (NameError) The output of ****************** a = ["a","b","c","d"].collect! {|x| x+"!"} p a ****************** is the indented >> ["a!", "b!", "c!", "d!"] what is going on ? Also the new method is removed from Fixnum on the other hand the code segment ************ p 34.id == 34.id ************ returns >> true - in contrast to ************ p "x".id == "x".id *************** which returns >>false. From this I would conclude that ``34'' is semantically a singleton ``34'' object - but the interpreter barks at the following lines ********* module Withbla def bla end end x = 34 x.extend(Withbla) *********** with the complain >> `extend_object': can't define singleton (TypeError) - what is the semantic reasoning behind this? Thanks, Christoph