From: Kent Dahl Date: 2003-06-25T01:30:31+09:00 Subject: Re: Block Scope Statement in the Pickaxe Robert Klemme wrote: > > "Kent Dahl" schrieb im Newsbeitrag > > Point taken. For brevity I think I would prefer simply: > > in `instance_eval': wrong argument type Proc (expected String or > > associated block) > > > > The 'no args' bits feels like line noise reading it. > > Sounds good. Now that that's settled, who's gonna put it into source > code? :-) As I went looking into the source, I noticed that the behaviour has changed from 1.6.8 to 1.8.0-pre3: [kentda@v052a ruby-1.8.0]$ ./ruby -v ruby 1.8.0 (2003-06-23) [i686-linux] [kentda@v052a ruby-1.8.0]$ ./ruby -e "instance_eval proc { }" -e:1:in `instance_eval': cannot convert Proc into String (TypeError) from -e:1 The reason appears to be due to a more generic approach where any object pretending to be a string (i.e. implements to_str) is acceptable. I can't see any elegant way to do it. Either: 1) Check if it is a Proc before the to_str stuff. But what if it the Proc has to_str implemented? 2) Catch the exception and augment the error message. Hmm, maybe it is too much hand-holding to do so. I'm leaning back towards the "I was sleepy/an idiot at the time" position. -- (\[ Kent Dahl ]/)_ _~_ _____[ http://www.pvv.org/~kentda/ ]_____/~ ))\_student_/(( \__d L b__/ (pre-) Master of Science in Technology ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)