If any of you remember the part of the hearings where he said: "it depends on what the meaning of the word is is" I recently went around in circles for awhile trying to figure out why a simple little bit of Ruby I had written wasn''t doing what I expected it to. turns out I had somewhat carelessly initialized one of the terms in my bit of Ruby code to ":false" rather than "false". In the process of finding this and pondering it for a bit and searching various texts for ":false" I came to the realization that I have no bloody idea what the heck :false means. Can somebody help me out here? When (if ever), should I use :false instead of false? Same question for :true vs true? Is the answer the same? That depends on what the meaning of the word is is... thanks, jp -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
2007-Aug-07 01:38 UTC
Re: A Rails question for Bill Clinton
Hi -- On Tue, 7 Aug 2007, Jeff Pritchard wrote:> > If any of you remember the part of the hearings where he said: > "it depends on what the meaning of the word is is" > > I recently went around in circles for awhile trying to figure out why a > simple little bit of Ruby I had written wasn''t doing what I expected it > to. > > turns out I had somewhat carelessly initialized one of the terms in my > bit of Ruby code to ":false" rather than "false". > > In the process of finding this and pondering it for a bit and searching > various texts for ":false" I came to the realization that I have no > bloody idea what the heck :false means. > > Can somebody help me out here? When (if ever), should I use :false > instead of false? > > Same question for :true vs true? Is the answer the same?:false and :true are symbols, just like :x, :hello, and :abc. They don''t have any relation to the objects false and true. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
This sounds more like a rails question for Gertrude Stein, to be honest. There is no :there there. :true and :false have no special meaning in Ruby. They are symbols. If you are using them interchangeably with true and false, you''re only creating bugs. Really, symbols are useful wherever you might be using a string over and over again as a token to represent some state or other. They are more efficient than strings in this context. google ''ruby symbols versus strings'' and you''ll get some good results. MIke. On Aug 7, 2:29 am, Jeff Pritchard <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> If any of you remember the part of the hearings where he said: > "it depends on what the meaning of the word is is" > > I recently went around in circles for awhile trying to figure out why a > simple little bit of Ruby I had written wasn''t doing what I expected it > to. > > turns out I had somewhat carelessly initialized one of the terms in my > bit of Ruby code to ":false" rather than "false". > > In the process of finding this and pondering it for a bit and searching > various texts for ":false" I came to the realization that I have no > bloody idea what the heck :false means. > > Can somebody help me out here? When (if ever), should I use :false > instead of false? > > Same question for :true vs true? Is the answer the same? > > That depends on what the meaning of the word is is... > > thanks, > jp > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeff Pritchard wrote:> Can somebody help me out here? When (if ever), should I use :false > instead of false? > > Same question for :true vs true? Is the answer the same? > > That depends on what the meaning of the word is is... > > thanks, > jpNever.... :string is a symbol. Its a technique used by the rails gods to indicate that this is just anty old string, but the the name has a meaning... And symbols are reused throughtout the app so :string will only use memory for one symbol even if used a 100 times in the app... true means "true", :true is a symbol and has nothing to do with the boolean value... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---