Good summary. Let's keep them separate until we feel pain.

- Stuart Halloway

> They work rather differently.  duck-streams/file treats all arguments
> as strings, so
> (file "foo" "bar")  =>  <File "foobar">
> I wrote it that way because I often want to construct a file name like
> (file base "." extension)
>
> java-utils/file is closer to the Java File interface, by assuming that
> each argument is a separate directory name.
> (file "foo" "bar")  =>  <File "foo/bar">
>
> I don't see an obvious way of combining them.
>
> java-utils/file is more efficient because it doesn't have to do any
> string manipulation.
>
> My opinion?  java-utils/file is more Java-like; duck-streams/file is
> more Ruby-like.  Neither is particularly Clojure-like, that would just
> be (File. "foobar").
>
> -Stuart Sierra
>
>
> On Apr 5, 5:30 pm, James Reeves <weavejes...@googlemail.com> wrote:
>> I'd like it if they were combined. You could then use (file "foo/ 
>> bar")
>> or (file "foo" "bar").
>>
>> - James
>>
>> On Apr 5, 9:25 pm, Stuart Halloway <stuart.hallo...@gmail.com> wrote:
>>
>>> Doh! Missed that. The duck-streams and java-utils versions of file
>>> have overlapping but disjoint functionality. Other-Stuart, I can  
>>> take
>>> a look at combining these, or we can just leave them separate for  
>>> now.
>>
>>> --Stuart
>>
>>>> On Apr 5, 5:07 pm, Stuart Halloway <stuart.hallo...@gmail.com>  
>>>> wrote:
>>>>> Never worry about "foo" vs. (File. "foo") again!
>>
>>>>> (doc file)
>>>>> -------------------------
>>>>> clojure.contrib.java-utils/file
>>>>> ([arg] [parent child] [parent child & more])
>>>>>    Returns a java.io.File from string or file args.
>>
>>>>> Notes:
>>
>>>>> (1) You will need to build contrib from source to see this.
>>
>>>>> (2) This function is a slight generalization of a similar  
>>>>> function in
>>>>> Compojure. James, I am hoping to convince you to make Compojure
>>>>> depend
>>>>> on contrib and start using a standard set of utils. What do you
>>>>> think?
>>
>>>> There's actually a file in clojure.contrib.duck-streams that's  
>>>> pretty
>>>> similar to this. In fact, I removed the file function from  
>>>> Compojure
>>>> because it clashed with duck-streams :)
>>
>>>> - James
> >


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