Warren, I can't speak for others, but I can say that personally one of the
reasons I love Clojure so much is that it doesn't try to be a OOP language,
instead it cleanly separates data from logic. Clojure is not a OOP language
and (hopefully) will never attempt to be so. But this separation of logic
and data should be very, very carefully examined. Here's an example:

(defprotocol IFoo
  (foo-func [this]))

(defrecord Foo [num]
  IFoo
  (foo-func [this] num))

(defn foo [num]
  (Foo. num))

This is the idiomatic way to write Clojure code, and if you read the .java
files in Clojure you'll see that they are laid out the same way. Many
classes have a static "create" function that does the actual data
processing, while the constructors do simple assignment. So what's so great
about all this? To the OOP programmer you would see this as "an interface,
a object with a overriding member, and a factory function". But this is
simply not the case. What we are defining, is a collection of polymorphic
functions (IFoo), a data-structure that installs a function into this
polymorphic function, and a constructor function.

So even here, where there appears to be OOP style abstractions and
conventions, it's really just syntactic sugar over FP code. Clojure is less
of a OOP language than most people realize.

Timothy

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