[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
end

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.

Dan

_________________________________________________________________
One-click access to Hotmail from any Web page – download MSN Toolbar now! 
http://clk.atdmt.com/AVE/go/onm00200413ave/direct/01/



More information about the win32utils-devel mailing list