seems there's no type hint required:

(def t nil)
(Thread. t)

also works...

How are you able to determine that it's calling the String constructor?

--Robert McIntyre




On Tue, Dec 28, 2010 at 3:08 AM, Alex Osborne <a...@meshy.org> wrote:
> Robert McIntyre <r...@mit.edu> writes:
>
>> what the heck...
>>
>> mailing-list.print-from-threads> (Thread. ((constantly nil)))
>> #<Thread Thread[Thread-100,5,main]>
>> mailing-list.print-from-threads> (Thread. ((fn  [])))
>> #<Thread Thread[Thread-101,5,main]>
>> mailing-list.print-from-threads> (Thread. ((fn  [] nil)))
>> #<Thread Thread[Thread-102,5,main]>
>> mailing-list.print-from-threads> (Thread. (let [this-is-nil ((fn  []
>> nil))] this-is-nil))
>> #<Thread Thread[Thread-103,5,main]>
>> mailing-list.print-from-threads> (Thread. nil)
>> ; Evaluation aborted.
>> mailing-list.print-from-threads> (= nil (let [this-is-nil ((fn  []
>> nil))] this-is-nil) ((fn  [])) ((constantly nil)))
>> true
>> mailing-list.print-from-threads>
>>
>> all of these things are referentially transparent, so how is clojure
>> differentiating between things that evaluate to nil and nil itself?
>
> It's picking the Thread(String name), constructor for some reason when
> it gets an Object type hint.
>
> user> (let [^Object o nil] (Thread. o))
> #<Thread Thread[Thread-8,5,main]>
>
> --
> 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 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

Reply via email to