From: Robert Klemme Date: 2009-11-10T00:28:56+09:00 Subject: Re: FileString - request for comments 2009/11/9 Eleanor McHugh : > On 9 Nov 2009, at 13:54, apeiros@gmx.net wrote: > It would probably be fairly trivial for you to directly support mmap at the > OS level using Ruby/DL, Ruby-FFI or even syscall (although that's ugly and > fragile). I am still trying to wrap my head around the question whether hiding file IO behind a String API is a good idea. Basically the reason to create something like this is to be able to use a file in places which expect to be given a String instance. However, code that uses String assumes fast access to arbitrary portions of the string. When those accesses are translated into random accesses to a file performance _might_ suffer dramatically. Put differently: hiding the fact that we are dealing with a file is convenient but may actually break your neck. And although at a certain level of abstraction a file and a String are pretty much the same (sequence of chars / bytes) it may actually be a good thing to keep the API separate in order to treat both appropriately. Stefan, what's your experience? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/