From: Jamal Soueidan Date: 2007-04-04T19:19:25+09:00 Subject: Re: Everything is a object? Devin Mullins wrote: > Jamal Soueidan wrote: >> so in Ruby everything is object if it was declared before :P o > I think perhaps the more accurate, though less sexy, wording is "every > expression that returns returns an object."* > > For example: 'rescue' is not an object, it's a keyword. > 'begin..rescue..end' is an expression, and hence has a return value, and > that return value is an object. I thought they are methods :) I thought keywords are class, def, end, which mean something to the compiler only. I did not think there would be something that behaved like a method "defined?" which would be keyword? Why not just make it a global method, put it in a module so nobody is confused about that, because it looks like a method to me :) 1 - so keywords can act as methods? 2 - keywords are build in into the language itself (Ruby)? 3 - maybe keyword are just a name, keywords can also act as methods? but you can't create them, number 2. > Also, if you find yourself using defined? more than once a year, you > might wanna post some code to ruby-talk for constructive criticism.*** > Actually, I was just trying various objects from the Ruby documentation page, just to get a idea about the methods which I can use :) but the code below let me think about "everything is object" and I thought that must be wrong, since the code below is not working :S if a.nil? p 'thanks'; end -- Posted via http://www.ruby-forum.com/.