[Win32utils-devel] Reworking win32-mmap for the pure Ruby version

Daniel Berger djberg96 at gmail.com
Tue Jul 4 13:40:02 EDT 2006

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 

* 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 

Any and all comments are welcome.  Note that you'll need the latest 
windows-pr from CVS to make this work as-is.



PS - Happy 4th of July!

More information about the win32utils-devel mailing list