Hey all, I have been going over the new web interface in Guile 2.0, making sure that it's OK for long-term use, and got myself into a quandary about when to use strings and when to use symbols in an interface. I don't pretend to have the right answer here, but this is the answer that I have come to.
Let's say you have an association list. It could be (("foo" . "bar")) or ((foo . "bar")) or ((foo bar)), or even (("foo" . bar)). If you're parsing this data from over the network, in textual form, which do you use? The answer is this: * Use symbols when you want to match against a symbol literal in your source code. * Use strings otherwise. * Don't worry about symbol-interning attacks, where the remote side fills up your symbol table -- symbols are properly garbage-collected in Guile 2.0. So in this case, the answer is ((foo . "bar")) if you would ever do (assoc-ref alist 'foo) in code, and (("foo" . "bar")) otherwise. Cheers, Andy ps. I very, very rarely hold Python up as an example of language design, especially regarding strings, but I think that their approach to string mutabililty and identity is preferable to the symbol vs string distinction that Scheme has. -- http://wingolog.org/