aspose file tools*
The moose likes Ruby and the fly likes (ruby) variables with colons in front Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Ruby
Bookmark "(ruby) variables with colons in front" Watch "(ruby) variables with colons in front" New topic
Author

(ruby) variables with colons in front

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Are there any specific convention with regards to variable naming in Ruby?

I was looking at some rake tasks and was led to believe that their names have a colon in front because it is an internal DSL (according to Fowler).

Then I took a look at this; and variables with colon prefixes are everywhere.

Please enlighten me.

Thanks

Pho
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 3014
    
  10
In Ruby, an identifier that begins with a colon is a symbol.
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Thank you. So Symbols are basically interned Strings in java.

Regards,

Pho
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Originally posted by Pho Tek:
Thank you. So Symbols are basically interned Strings in java.

Exactly.


A good workman is known by his tools.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: (ruby) variables with colons in front