Encapsulation:
a) I don't miss it.
b) Functions/private-namespaces/maps/deftypes can serve this purpose.

Inheritance:
Clojure provides ad-hoc hierarchies, which give you the desired tree
structure of a type-hierarchy, but it is decoupled from implementation
details.  You can inherit implementations in lots of ways in clojure.  The
simplest conceptually in my mind is simply a hash-map of keys to functions.
 Once you start doing it, the question shifts to "do you need a 'this'
pointer"? 'this' makes a first argument to a pure function implicit. In
most cases, you don't need it.  If you do need it, deftypes or records can
fill in the gap.  Records and deftypes also participate in protocols, which
provides...

Polymorphism:
Single-dispatch is a degenerate case of more generalized multiple dispatch,
which we have via multi-methods.  It turns out that JVMs are pretty good at
it, but conceptually I think of 'dispatching on the type' as an
implementation detail or optimization, not something to build a language
around (java, C++, ...).  Protocols give this kind of fast-implementation
polymorphism back to you in a decoupled form.  Reify/proxy are just so
darned convenient, both with JVM interfaces and clojure protocols.

There's nothing missing here, it's just disassembled and presented back to
you in pieces as part of a practical and philosophical argument.  This is
the 'design by decoupling' thought.

What _is_ missing here is an actually helpful static type-system (there's
WIP), but immutable data is the best glue for a dynamic one, in my opinion,
as it provides easy isolation of components.  I don't miss java's, that's
for sure.

Some things that didn't look like syntactic sugar will start to look like
syntactic sugar once you get deep into compiler internals and macros :-).
 Lisp broke me in this way, but I like it.


On Thu, Dec 26, 2013 at 8:32 AM, Massimiliano Tomassoli
<kiuhn...@gmail.com>wrote:

> On Thursday, December 26, 2013 9:01:56 PM UTC+1, HamsterofDeath wrote:
>>
>> exactly which part of OOP is missing in clojure that you would like to
>> use?
>> if you took my java code and ported it to clojure, the main difference
>> would be (a b) instead of b.a , but the main design would be similar
>>
>
> How can that be? What about encapsulation, inheritance and polymorphism?
> OOP is not just syntactic sugar.
> If I were to implement something (complex enough) in C and C++ the
> differences between my implementations would be far from superficial.
>
> --
> --
> 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