[Chicago-talk] Class::Accessor uses a hashref - a question ofstyle

Jay Strauss me at heyjay.com
Sun Jan 25 17:44:45 CST 2004


Thanks Jim

Jay
----- Original Message -----
From: "Jim Thomason" <jthomasoniii at yahoo.com>
To: "Chicago.pm chatter" <chicago-talk at mail.pm.org>
Sent: Sunday, January 25, 2004 1:57 PM
Subject: Re: [Chicago-talk] Class::Accessor uses a hashref - a question
ofstyle


> > Now the question:  Is it just a personal preference
> > to use a hash or a
> > hashref when creating a class.  Or is one one syntax
> > preferred by those
> > people who make the rules?
>
> As far as I'm concerned, it's a personal preference.
>
> Some people prefer it, since you're passing by
> reference instead of by value. Realistically? As long
> as those hashes or keys or values or whatever aren't
> huge, it's not going to make a difference 99 times out
> of 100. Speed and memory won't be perceptibly
> affected.
>
> I've also heard it used in times where someone wants
> to keep open the option of passing in additional
> arguments outside of that hash value.
> ($class->new(\%args, $someothervar)). Again, I'd
> personally rather stick 'em in that args hash.
>
> The only other possible advantage I can conceive of is
> that you're not required to de-reference a hashref if
> you already have one.
>
> I'd say that consistency is usually more important
> than one or the other. Pick one and stick with it, if
> possible.
>
> -Jim....
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
> http://webhosting.yahoo.com/ps/sb/
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
>




More information about the Chicago-talk mailing list