Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The article is a bit confusing, but I like the concept behind symbols: Basically a way to distinguish identifier names (chosen by the programmer) from user-facing strings.

The distinction between is one I've mentally adopted in other languages like Python as well. For personal projects I like to use single quotes for 'symbols' and double quotes for "strings", e.g.:

    add_label(text="Hello World!", align='center')
Does anyone else do something similar?




Single vs double quotes is also semantically significant in Ruby. Double quoted strings support interpolation whereas single quoted does not.

I almost never use single quotes unless I’m in someone else’s code that already used single quotes. And then I have to fight the urge to not change everything to double quotes just because.

I have been with you for a very long time,until I recently realized how tricky the edge cases are, I cannot figure out a good rule.

A json api, should it use symbols or strings?

Json has string keys, but the api keys are chosen by the programmer.

I can't remember which edgecase,but there are another bunch I found that are tricky.


> Does anyone else do something similar?

I do exactly the same thing. Did you also derive it from Erlang?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: