On Mon, Dec 29, 2008 at 8:02 PM, CuppoJava <patrickli_2...@hotmail.com> wrote:
>
> The reason I'm asking about this is that it's quite standard practice
> to set up some parameters inside the constructor of a class.
>
> ie. A use-case like this is quite common, and (I think) reasonable.
>
> public class MyThread extends Thread{
>  public MyThread(){
>    setName("This is my thread");
>  }
> }
>
> So whenever the user creates an instance of MyThread, he can be
> guaranteed that the thread's name has already been appropriately set.
>
> How would you do this in Clojure?

The example I posted does exactly this -- the name of all MyThreads
start as "my derived class" as demonstrated by:

user=> (.getName x)
"my derived class"

--Chouser

--~--~---------~--~----~------------~-------~--~----~
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
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