The Java class lifecycle and namespaces/vars are separate sorts of
'resolution contexts', but they're (un)fortunately deeply tied together.


On Thu, Oct 31, 2013 at 11:24 AM, Mars0i <marsh...@logical.net> wrote:

> On the other hand, the behavior of Point. might be considered a good thing
> (or not):
>
> user=> (defrecord Point [x y])
> user.Point
> user=> (meta #'Point.)
> CompilerException java.lang.RuntimeException: Unable to resolve var:
> Point. in this context, compiling:(NO_SOURCE_PATH:6:1)
> user=> (meta #'->Point)
> {:ns #<Namespace user>, :name ->Point, :arglists ([x y]), :column 1, :doc
> "Positional factory function for class user.Point.", :li
> ne 5, :file "NO_SOURCE_PATH"}
> user=> (def ->Point 42)
> #'user/->Point
> user=> ->Point
> 42
> user=> (->Point 3 2)
> ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn
> user/eval245 (NO_SOURCE_FILE:10)
> user=> (Point. 3 2)
> #user.Point{:x 3, :y 2}
> user=> (def Point. 43)
> #'user/Point.
> user=> (Point. 3 2)
> #user.Point{:x 3, :y 2}
>
> I can't clobber Point. by def'ing it.  It's as if Clojure turns into a
> Lisp-2 in this one special case.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to