What is the purpose for using symbols?

20 views
Skip to first unread message

Jeff Shutt

unread,
Sep 29, 2011, 10:34:35 AM9/29/11
to orbr...@googlegroups.com
So I have been using this for a bit and really enjoying is but I am still confused at what purpose the symbols serve? After initially browsing the examples I thought perhaps I would understand their purpose after using the library some, but I still haven't figured it out. That being said, I still don't have a grasp of what purpose are for in the Scala in general. I have googled it a bit, but not finding what I am looking for. So I thought perhaps if you explained them in context of ORBroker, it might click for me. Thought?

Thanks!

Nils Kilden-Pedersen

unread,
Sep 29, 2011, 11:52:53 AM9/29/11
to orbr...@googlegroups.com
Symbol instances in Scala are always singleton instances. That means that the equality is determined as instance equality, which is much cheaper than String comparison. That is the theory. In reality it probably doesn't matter when dealing with DB I/O operations.

It's primarily used in O/R Broker to distinguish the type from String, which is used for inline SQL. So it allows better overloading of methods.
Reply all
Reply to author
Forward
0 new messages