[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [patch] Use hash for optional args with long argument list in Ruby bindings

From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: 2007-11-17 06:06:06 CET

Hi

On Nov 16, 2007 8:39 PM, Kouhei Sutou <kou@cozmixng.org> wrote:
> Hi,
>
> In <ae6cb1100711162027r44ac7627qa0d44964b0bf03fa@mail.gmail.com>
> "Re: [patch] Use hash for optional args with long argument list in Ruby bindings" on Fri, 16 Nov 2007 20:27:50 -0800,
> "Joe Swatosh" <joe.swatosh@gmail.com> wrote:
>
> > > Using keys of default options is OK but I don't define
> > > default options as constant. I want to generate default
> > > options each time because we may change default options
> > > destructively by mistake.
> > >
> >
> > If we freeze the constants, wouldn't we get TypeErrors if we were to
> > accidentally
> > try to modify them?
>
> Can you freeze all values without mistake? e.g.
>
> DEFAULT = {
> :targets => []
> }.freeze

Sure, but it isn't too pretty:

 DEFAULT = {
   :targets => []
 }.freeze.each_value{|v| v.freeze}

:-)

> isn't enough. We need to write like the following:
>
> DEFAULT = {
> :targets => [].freeze
> }.freeze
>
> # And I don't want to see many 'freeze'.
>

I understand. Shouldn't we move REQUIRED_UPDATE_EDITOR_KEYS
the method for the same reasons?

--
Joe
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Nov 17 06:06:17 2007

This is an archived mail posted to the Subversion Dev mailing list.