Go Back   CodingForums.com > :: Server side development > Ruby & Ruby On Rails

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-22-2012, 03:39 PM   PM User | #1
Keleth
Senior Coder

 
Join Date: Jun 2008
Location: New Jersey
Posts: 2,354
Thanks: 45
Thanked 247 Times in 244 Posts
Keleth is on a distinguished road
Symbols as function names?

I think the biggest road block I have with ruby right now is symbols. I'm not quite grasping their use.

So far as I understand it, its an efficiency system of using the same short string multiple times, as an identifier (such as for a hash key). However, I'm not seeing their use/purpose beyond that.

Further more, one of the guides I'm currently following (Learning Ruby the Hard Way), defines a function, then uses a symbol of the function name to reference it. Are function names automatically defined as symbols? As a function name has to be unique, why use a symbol to represent it? Is this acting more like a pointer?
Keleth is offline   Reply With Quote
Old 06-01-2012, 09:16 AM   PM User | #2
kaizenfury7
New to the CF scene

 
Join Date: May 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
kaizenfury7 is an unknown quantity at this point
What's the example from Learning Ruby the Hard Way that you're referring to?

I use symbols purely for efficiency. I'm guessing the example is passing some method a method name as a string, and is looking up the method to call it. Hopefully I can tell you more after seeing the example.
kaizenfury7 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:06 PM.


Advertisement
Log in to turn off these ads.