From: Ron Jeffries Date: 2002-01-13T02:06:18+09:00 Subject: Re: Dir.entries have no home On Fri, 11 Jan 2002 22:20:33 GMT, Dave Thomas wrote: >Ron Jeffries writes: > >> I'm suggesting that the objects involved in the Dir.entries, >> FileTest, and File families aren't quite right. Think of it this >> way: > >and/or... > >The interface to Dir is wrong. Right now, it's basically a wrapper >around system calls. Perhaps it would be better to have something like > > Dir#parent > Dir#subdirectory_names_matching(glob) > Dir#file_names_matching(glob) > Dir#other_names_matching(glob) > Dir#contains_file_named(name) > Dir#path > Dir#remove_files > Dir#remove_sub_directories Yes. Or maybe Dir itself is the wrong model. Some files are directories and some are not. So the base element could be considered to be (picking up Massimilano's idea) FileDescription. The object would know its long pathname and have methods to answer a suitable combination of questions from Dir, File, FileTest and File::Stat. I guess I'll have to study all that stuff at a deeper level and see what comes to me. Riddle me these things, please: 1. Suppose Dave is right and the interface to Dir is wrong or that Massimilano is right and we need a FileDescription. What happens in the Ruby world to move in that direction? Should Chet and I just do something and publish it somewhere? Or is there something more formal we should do? 2. I'm essentially entirely ignorant of OSs that aren't Windows and that I didn't write. In Windows, '.' names the current working directory, and '..' names the parent of the cwd. Is that true in (all, some, no) other OSs? 3. Tell me one more thing I should ask about, and its answer. ;-> Thanks! Ronald E Jeffries http://www.XProgramming.com http://www.objectmentor.com I'm giving the best advice I have. You get to decide whether it's true for you.