3 ms·
Rust's usage of single quotes comes from CS language theory (lifetimes are denoted using quotes) which I believe comes from the normal usage of quotes in posses
by cyphar 9y ago
Rust's usage of single quotes comes from CS language theory (lifetimes are denoted using quotes) which I believe comes from the normal usage of quotes in possessive words (James', Amanda's). I don't think LISP's usage comes from the same place (it means something very different semantically).
- Jtsummers 9y agoLisp's quote (or ') comes from the word quote and the context: (quote something) Meaning: take whatever follows and leave it alone. Do not interpret it. If it's a list it stays a list (one of the main uses for this). The single quote ' is shorthand for that. It's meant to be an easier way to create a literal list (and other things) without escaping all the parts of a list that might be misinterpreted as symbols to evaluate (to values or functions).
- steveklabnik 9y agoOCaml's usually what I see cited as the reason for Rust adopting the syntax.
- mcguire 9y ago... where it's a type variable. I think we can blame the use for lifetimes entirely on the Rusties.
- steveklabnik 9y agoLifetimes are also types, or more specifically, generic type parameters.
- cyphar 9y agoI believe the community name is Rustacean[1]. [1]: http://www.rustaceans.org/ http://www.rustaceans.org/