On Wed, Feb 18, 2009 at 8:05 AM, Roger Hall <raha...@ualr.edu> wrote:
> All,
>
>...
>
> Do I have to redesign the module to get past this syntatical doppelganger?


If you redesigned, replacing your hash with an array would be harder
to typo, faster, smaller, not as nice to dump with Dumper, and harder
for 3rd parties to extend.

From:
  $obj->{foobar} = ...

To:
  use constant FOOBAR => 0;
  $obj->[FOOBAR] = ...


Harder to typo:
  $obj>[FOBAR] # syntax error

Faster:
  $obj->[0] is faster than $obj->{foobar}

Smaller:
  Peek with Devel::Peek to get an idea

Not as dumpable:
  You get [ ... ] instead of { ... }

Unless you implement some kind of ->hashify method.

It's a mixed bag, on the whole I prefer array objects to hash objects
for the built-in typo detection. I need it.

Josh

Reply via email to