Skip to content

Commit 468c996

Browse files
committed
Update design doc
1 parent 085344c commit 468c996

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

clojureRS.org

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff 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).

0 commit comments

Comments
 (0)