From: Robert Dober Date: 2006-09-12T06:19:22+09:00 Subject: Re: string as nil or empty string? ------=_Part_7774_16431295.1158009536687 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 9/11/06, Francis Cianfrocca wrote: > > > > nil signifies the absence of an object, so you can always set a strange sentence you have written, I am quite surprised, nil is an object and can thus not signify the absence of an object I am sur= e you agree and yet of course what you say is very much what we all mean most of the time when we use nil Look at the following code I use often x =3D nil # need to define x outside of blocks I will use it in # note that I do not use nil to identify falseness or absence I just use # it because the language foreces me to assign a value to x and nil comes # into my mind, but somehow I doubt that it is such a good idea { ... using x ...} Why the heck do I not write x =3D Object.new { ... using x ...} or just of course x =3D 42 { ... using x } It is very very easy to slip from definitions to conventions or rather the other way round. ... > > > This would violate a fairly deep expectation that the only values in > Ruby which evaluate to logical-false are nil and instances of class > FalseClass (of which there is only one, of course). Again interesting that you kind of have this unorthogonal view, as you coul= d have written, are instanecs of the classes NilClass and FalseClass I wonder for a long time about the concept of having a value indicating the absence of a value. I think the conecpt is flawed -useful- but flawed. Any thaughts? Cheers Robert P.S. (1) maybe it would be nice to have one singlteon object None or Void or Omega that has the special property of not having any method and to raise a= n UndefinedError whenever read. Maybe I will put this into my toolbox. class VoidClass ... undefine all instance methods def method_missing(*a,&b); raise UndefinedError, "You tried to access an undefined object" ... R. --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_7774_16431295.1158009536687--