File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,3 +137,26 @@ Perhaps they could look like
137137
138138 (div 5 0)))
139139#+END_SRC
140+ ** Symbols, Interning
141+ In Clojure proper, there is specific semantics for keywords and symbols -- namely,
142+ #+BEGIN_SRC clojure
143+ (intern "namespace" "name")
144+
145+ (intern "namespace/name")
146+ #+END_SRC
147+ Since Rust doesn't have overloading, we can either do
148+ #+BEGIN_SRC rust
149+ pub fn intern(ns: Option<&str>, name: &str)
150+ #+END_SRC
151+
152+ Or just have two functions. So we've gone with the latter
153+
154+ #+BEGIN_SRC rust
155+ intern(name)
156+ intern_with_ns(ns,name)
157+ #+END_SRC
158+ To be honest, from my time in other languages I've gotten used to
159+ the idea of naming all your functions, giving you all these little
160+ 'offshoots' of, say, intern in this case (although its basically namespacing
161+ in a way; anytime you're doing something like blah__1 blah__other blah__3,
162+ your blah has become a 'family name' of sorts; a namespace).
You can’t perform that action at this time.
0 commit comments