Hi all,
Since yesterday, I've been thinking about something David Nolen said in
my /"what on earth is happening?"/ post. In a nutshell, he suggested
that protocols *should* be fully populated. Luc from softaddicts agreed
and actually shared his own horrific experiences with non-fully
populated protocols. Before continuing I should point out that I'm
looking for a discssion - not a debate...learning is the ultimate goal
here...:-)
So let's just leave Clojure aside for a moment...
In java, when we've got an interface that we want to implement we've got
literally no choice. We have to implement every single method/arities.
Consequently, whenever a particular method/arity doesn't quite fit from
the implementer's viewpoint, it is implemented throwing an exception or
returning something irrelevant like null (most cases that I've seen
exceptions are thrown). everything fine so far yes?
Now, let's move to Clojure...the backbone of every protocol is
essentially an interface right? Every time we leave an unpopulated
implementation of some protocol-fn the Clojure compiler generates
exception stubs for it in the implementers' code...in other words, we
may have left it unpopulated but Clojure populated it with that
exception stub. *How is that different from populating it and providing
the exception stub ourselves as we'd do in Java? *It is my understanding
that the compiler does that so that we don't have to repeat code (I
guess something similar to the 'with-open' macro). Is my understanding
that wrong?
thanks a lot in advance,
Jim
--
--
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.