| And to be completely clear, I'm not complaining about the design decision in 
Clojure. I'm just trying to really understand what the design is, what are the 
trade-offs and where the confusion might come from.

conj is what is known as a leaky abstraction. Leaky abstractions aren't always 
bad, sometimes they are made leaky by choice. A leaky abstraction is one that 
reveals and requires you to be aware of its underlying concrete implementation.

Generally an abstraction is made leaky when the implementation details are in 
fact very important to the success of using the abstraction for real world use 
cases.

This I think was the choice made for conj. You can see that from the docstring 
itself: "The 'addition' may happen at different 'places' depending on the 
concrete type."

The docstring directly points you towards knowing that the concrete types add 
the element in different places. That knowledge is leaky.

But, its also very important, because in many real world use cases, performance 
of addition will matter, and order of addition will matter, and you'll want to 
choose the correct concrete type to get the order you want with the performance 
you need.

Generally, leaky abstractions are more annoying to use for simple use cases, 
since often you want to say, I don't care about all the little details, but as 
your use case grows, the devil sometimes shows up in thise details, and 
suddenly, that leakyness becomes a blessing.

So, did Clojure made the right choice in making conj leaky? Hard to say, and 
the answer is probably personal and opinionated. That said, I'm sure the intent 
was to force the details onto the user, and force them to be aware of their 
implications when using conj.

-- 
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/d/optout.

Reply via email to