Excellent. Thanks Tassilo. I had attempted to do the same sort of thing
using
Point.
rather than
->Point
which didn't work:
user => (doc Point.)
nil
user=> Point.
CompilerException java.lang.ClassNotFoundException: Point.,
compiling:(NO_SOURCE_PATH:0:0)
user=> ->Point
#<user$eval254$__GT_Point__269 user$eval254$__GT_Point__269@3c90fa05>
I had assumed that Point. and ->Point were the same thing, but they are
apparently not. ->Point names something real, while Point. is just some
kind of magic, I guess.
user=> (def Point. 5)
#'user/Point.
user=> Point.
CompilerException java.lang.ClassNotFoundException: Point.,
compiling:(NO_SOURCE_PATH:0:0)
The fact that Point. is associated with the record type Point causes this.
I'll stick to using the -> syntax from now on. Less confusing.
(Also, I didn't know in detail how to perform the alter-meta! operation.
Looks pretty ugly, but it's easy enough to wrap it up in a function.)
On Wednesday, October 30, 2013 11:19:33 AM UTC-5, Mars0i wrote:
>
> I understand that defrecord can't take a docstring (see "Doc string for
> variables and record" in this group), and I have learned that record types
> are somewhat odd beasts. I know that there are workarounds (
> http://clojure-log.n01se.net/date/2010-10-03.html).
>
> Still, I'm surprised. *Why* can't I document a record type with a
> docstring?
>
> It seems like extremely useful coding practice to provide a docstring for
> a type. Even if the underlying semantics would be weird and special-cased,
> well, that's already true for record types.
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.