Another detail to remember for Clojure / other FP languagens, is that "we
don't have objects!", most of time we are using basic structures, and none
of them has "methods", in case, most of time we are expecting lists or
hashes, in hashes, we most of time expect some keys to be present, and
that's all...

I really don't like to mix up clojure code with Java, when I really need
Java, I always write some wrappers, so when I use it feels more Clojure.
---
Wilker LĂșcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600



On Tue, Sep 20, 2011 at 8:51 PM, Laurent PETIT <laurent.pe...@gmail.com>wrote:

> Hello,
>
> The problem I see with using types is that imposing type X and type Y for
> the input arguments of method f is generally imposing too much constraint.
> Generally, the function just needs a subset of the types characteristics,
> and that's where genericity disappears.
>
> I would see no problem of e.g. having a way to explicitly declare, in the
> "public interface of the function" (as opposed to "derived implicitly from
> the current implementation detail of the function") the necessary
> constraints on the function arguments. And the guarantees on the function's
> result.
>
> Those could then allow more checks at compile time, without sacrificing
> genericity of the code.
>
> Using interfaces in java is a way towards that goal, though since java does
> not allow to retrofit existing classes into new interfaces, this generally
> falls short of being generic enough.
>
> Using protocols in clojure, and with the property of protocols that they
> are implied to be more orthogonal than to form a hierarchy, seems
> interesting in this area.
>
> Finally, there will still be functions which are doing the specific jobs
> for specific types/records/whatever => so there's certainly still merits to
> be able to constrain some function arguments to specific types.
>
> HTH,
>
> -- Laurent
>
>
> 2011/9/20 Sean Corfield <seancorfi...@gmail.com>
>
>> On Mon, Sep 19, 2011 at 4:19 PM, Dennis Haupt <d.haup...@googlemail.com>
>> wrote:
>> > an advantage i see is very, very concise code since you have no type
>> > annotations at all. the downside is that exactly this code might be
>> > unreadable - because you just have no idea what it uses and what it
>> > does without tests or documentation.
>>
>> I find Clojure code more readable because it is generic. Instead of
>> some algorithm specialized by type, Clojure often deals with simpler
>> generic algorithms that are applicable to a broader class of data
>> structures which can also mean more reuse.
>>
>> Writing truly generic code in the presence of a strong type system is
>> often harder word and tends to produce much more dense, more annotated
>> code that I find harder to understand. Take a look at the
>> documentation for the Scala collection library, for example (I'm not
>> dissing Scala - I like Scala, but I don't think anyone will disagree
>> that the auto-generated documentation based on the library type
>> signatures is very hard to read, at least for the "average
>> developer").
>> --
>> Sean A Corfield -- (904) 302-SEAN
>> An Architect's View -- http://corfield.org/
>> World Singles, LLC. -- http://worldsingles.com/
>> Railo Technologies, Inc. -- http://www.getrailo.com/
>>
>> "Perfection is the enemy of the good."
>> -- Gustave Flaubert, French realist novelist (1821-1880)
>>
>> --
>> 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 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 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