[Win32utils-devel] Trivial API question
win32utils-devel at rubyforge.org
win32utils-devel at rubyforge.org
Fri Feb 27 07:49:22 EST 2004
> -----Original Message-----
> From: win32utils-devel-bounces at rubyforge.org
> [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of
> win32utils-devel at rubyforge.org
> Sent: Thursday, February 26, 2004 4:54 PM
> To: win32utils-devel at rubyforge.org
> Subject: Re:[Win32utils-devel] Trivial API question
>
>
> >
> > I know - I like to futz. I'm thinking of changing the way I pass
> > optional arguments. This is from EventLog:
> >
> > # Write an event to the event log
> >
> > # Current way
> > el.report_event(
> > "source" => "foo",
> > "category" => 0x2,
> > "event_id" => 0x3,
> > "data" => "Warning! Danger Will Robinson!",
> > "type" => EventLog::WARN
> > )
> >
> > # Proposed way
> > el.report_event{ |e|
> > e.source = "foo"
> > e.category = 0x2
> > e.event_id = 0x3
> > e.data = "Warning! Danger Will Robinson!"
> > e.type = EventLog::WARN
> > }
> >
> > This looks a little "cleaner" I think and is a bit more
> Ruby-ish. It
> > would use a yielded struct, which has an advantage over a
> hash - you
> > can't pass a bogus key, i.e. builtin validation.
> >
> > What do you think? Or should I just leave it alone?
> >
> > Dan
> >
> Let's provide both ways :)
>
> Regards,
>
> Park Heesob
Ugh - too much work to maintain. I'm going to pick one and stick with
it.
Dan
More information about the win32utils-devel
mailing list