On Sat, Dec 12, 2009 at 11:03 AM, Sean Devlin <francoisdev...@gmail.com>wrote:

> Ummm.... some of these thing DON'T map to Clojure.
>
> I'd suggest you check out Rich's videos here:
>
> http://blip.tv/file/982823
>
> Anyway, as to how you would solve some of these problems in Clojure...
>
> Static methods you get for free, because everything is a function in
> Clojure.
>
> Singletons aren't really required, because using a keyword generally
> gets the same effect.  You can also use a memoize function to prevent
> expensive things being created more than once.
>
> As far as Inheritance & Interfaces are concerned... well, uh... those
> generally aren't used in Clojure.  Personally, I use a lot of maps
> where I used to use objects.  I've found that I like my code better
> now.
>

Inheritance & Interfaces can be achieved via multi-methods and types. Also
checkout deftype and defprotocol work in the new branch.


> Others might have some other ideas on how to com from Java to Closure.
>
> Sean
>
> On Dec 12, 8:13 am, ajay gopalakrishnan <ajgop...@gmail.com> wrote:
> > Hi,
> >
> > I come from a OOPS (Java) world and I am used to Singletons, Inheritance,
> > Statics, Interfaces etc.
> > I am reading the Programming Clojure book and I understand multi-methods
> and
> > when it is used.
> > But I am still not able to see how to achieve the effects of Singletons,
> > Inheritance, Statics, Interfaces etc. in Clojure. If the book explains it
> > somewhere, I would be glad to get a pointer to that too.
> > When I say "achieve the effects" , I am not asking if there is a way to
> > define a Singleton class etc. I am asking that if the design in my head
> has
> > all these things, how would I translate that into Clojure (some way or
> the
> > other) or what modifications would need to be made to my design (in my
> head)
> > to able to directly write it in Clojure terms.
> >
> > Thanks,
> > Ajay G.
>
> --
> 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<clojure%2bunsubscr...@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