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

They exist in K/Q. A single-word identifier-shaped symbol begins with a backtick, or a multi-word symbol can be created with a backtick and double quotes. A sequence of symbols is a vector literal, and is stored compactly. For example:

    `apple
    `"cherry pie"
    `one`two`three
Many languages will intern string literals implicitly, or allow a programmer to explicitly intern a string; for example Java's "String.intern()".

The problem with string interning, especially for strings constructed at runtime, is that for the interning pool to be efficient it is very desirable for it to be append-only, and non-relocatable. A long-running program which generates new interned strings on the fly risks exhausting this pool or system memory.




> A long-running program which generates new interned strings on the fly risks exhausting this pool or system memory.

So does a long-running program which generates new symbols on the fly.




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

Search: