On Tue, Nov 5, 2013 at 12:07 AM, Sur <sur....@gmail.com> wrote:
> Do you know what is the difference between a string and a symbol and why and
> where symbols are preferred over strings ?
>
> try this:
>
> a = "some string"
> b = "some string"
> b.object_id == a.object_id  (watch for the result of this expression)

> sym_a = :some_symbol
> sym_b = :some_symbol
> sym_b.object_id == sym_a.object_id  (watch for the result of this
> expression)

Preach on about this bullshit when Ruby isn't primarily used for web
applications and when Ruby allows my system to reclaim memory, until
then lets leave the symbol argument bullshit out of this.  Even if
they are constants they can lead to trouble if you just blindly state
they are better without explaining the dangers in a web application,
or people will repeat history, history people like me thought was
already common knowledge.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAM5XQnwbbuhVV9hxwLBC1%2BD_sqk%2BC2xPsCKt1gChQH-8vMCZaw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to