[Win32utils-devel] Quick thought on win32-mmap

win32utils-devel at rubyforge.org win32utils-devel at rubyforge.org
Sat Mar 13 21:28:03 EST 2004

I suggest getting rid of the hash style arguments fior new() for this 
package.  In this particular case, you already have a class and accessors, 
so you can just use the yield trick, e.g. rb_yield(self) if 
rb_block_given_p().  Thus you can do:

mm = Mmap.new do |m|
   m.namespace = file
   m.swapfile = sfile
   m.size = 1024

Looks just as nice, and is a lot less code on the C side of things.  I only 
use the hash-style keys when I don't feel like creating separate objects, or 
where separate objects don't really make sense.  I'll make this change 
unless anyone objects.


One-click access to Hotmail from any Web page – download MSN Toolbar now! 

More information about the win32utils-devel mailing list