|
I can understand the need for symbol literals in, say, LISP. There, a string was a sequence of bytes in a certain memory position. In this setting, string equality for instance, must be checked character after character. With symbols, one need only to compare the reference.
I don't see them used too much, in, say the Lift source, or various The obvious advantage of removing a syntax, is reducing the complexity of the language, and maybe even speeding up parsing a bit (' can be decided to be a character literal without the need for lookahead).
Except of that, a big disadvantage for the current symbol literal syntax, is, that it confuses C-like syntax highlighters. So, say in Stackoverflow.com, scala code that contains symbol literal looks really bad.
(see also this discussion, I can understand why one would need a class Symbol that would be bound to contain only strings which are legal scala method names. However I can't understand the need for extra syntax. Symbol("method_name") seems fine to me for this use case).
|
|
I like symbol literals. I have no rational reason for it, but I like them.
On Wed, Aug 4, 2010 at 1:54 PM, Elazar Leibovich <[hidden email]> wrote:
-- http://erikengbrecht.blogspot.com/ |
|
In reply to this post by Elazar Leibovich
On Wed, Aug 4, 2010 at 10:54 AM, Elazar Leibovich <[hidden email]> wrote:
> In the JVM however, strings behave more or less like symbol literals in this > respect. Why do we need extra syntax for symbol literals in scala? > I don't see them used too much, in, say the Lift source, or various "more or less" would worry me cf. http://javatechniques.com/public/java/docs/basics/string-equality.html ?? |
|
On Wed, Aug 4, 2010 at 11:57 PM, Raoul Duke <[hidden email]> wrote:
That's a potential noob Java problem, not applicable to Scala. |
|
In reply to this post by Raoul Duke
On Thu, Aug 5, 2010 at 7:57 AM, Raoul Duke <[hidden email]> wrote:
That's a good point for not using String in general for symbols. But I still don't see the need for a different syntax. We can use something like `case class Symbol(String sym) {sym.intern()}`, for symbols.
|
| Powered by Nabble | Edit this page |
