2010/5/13 Stuart Halloway <stuart.hallo...@gmail.com>:
>>  * I also have bad feelings when I see the Coercions protocol defined
>> but not used in conjunction with IOFactory for default behaviours
>
> There are very few examples of this, not worth making changing IMO.

I'll try to do this as an exercise if time permits. I don't like not
respecting DRY principle just after having defined the required
functions ...

> No. You cannot define part of a protocol at one level, and then get the
> object behavior for missing parts:
>
>>  * Could it be interesting to have as-reader as-inputstream
>> as-outputstream as-writer so that the do-copy methods could all be
>> resolved in terms of those primitive coercions, then resulting in less
>> handled combinations in the end of the methods definitions ?
>
> I actually tried that, and it make things worse.

Worse in what sense ? More locs ? Less readable ? (Sometimes one needs
to have more lines of code for less duplication of the logic (more
lines of code resulting in more functions being defined, with their
ceremonies, even if those are very short in clojure), and I don't
necessarily consider this a bad thing).

>>  * Could as-file be type hinted so that it's not necessary to do the
>> cast to ^File in as-relative-path ?
>
> This should work but doesn't yet, protocol type hint handling needs to flow
> through.

Is it expected to work before beta1 ?

>>  * Couldn't make-parents be renamed create-parents (interestingly
>> it's the verb "create" that is used in the javadoc)
>
> It's the original name from contrib. I am reluctant to change a name people
> have gotten used to unless the other choice is overwhelmingly better. I'll
> listen to the community on this one.

You're right. And "mkdir" is derived from "make dir", after all.

>>  * It's not clear from make-parents docstring that it accepts same
>> arguments as 'file function
>
> I like the docstring as-is but will take a better one if given it.

What about aligning its args definition as well as its docstring with
those of function file, as in :

(defn make-parents
  "Pass arg(s) as you would to function file, create all parent
directories of the file they represent. "
  {:added "1.2"}
  [arg & more]
  (.mkdirs (.getParentFile ^File (apply file arg more))))

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