Daniel Berger
2006-Jul-04 17:40 UTC
[Win32utils-devel] Reworking win32-mmap for the pure Ruby version
Hi all, I was looking at win32-mmap today. I thought it might be worth it to rewrite this one as pure Ruby. In the process, I decided I don''t really like the current API very much. Just feels too clunky and not very friendly. I think we followed Win32::MMF too closely. Anyway, I have a very preliminary version in CVS that I was hoping folks could take a look at and comment on. Just a few comments on why I changed some things: * I thought that OpenFileMapping should have its own method, i.e. MMap.open if you want to open an existing mapping, MMap.new if you want to create a new mapping. This felt conceptually cleaner than a "reuse" option, and helped reduce code clutter in the initialize method. * I ditched the hash style interface in favor of a block style "yield self". I just don''t feel like handling (validating, etc) hash keys any more. * I wanted the ability to explicitly close and flush a file mapping, so I added MMap#close and MMap#flush. Please note that this is a very alpha first attempt. Note the lack of a Semaphore for the mapping, for example. I want to think about that some more. Any and all comments are welcome. Note that you''ll need the latest windows-pr from CVS to make this work as-is. Regards, Dan PS - Happy 4th of July!