in reply to Re^3: RFC: The Poor Man's Accessor Filter
in thread RFC: The Poor Man's Accessor Filter

At the same time, there's still that Perlish allure of simplifying code which ought to look simple.

But simply looking code doesn't exclude repetition, or not using modules. A simple accessor, for instance the one found the OPs post, remains simple, even if repeated several times with just a change in the name of a variable. The human mind is geared towards recognizing patterns - it won't get confused, and a pattern is the opposite of line noise. OTOH, having a module generating the accessor for you will always leave some people with the question what really goes on in the accessor, and they'll have to look at, and understand, the code generating code in the module.

  • Comment on Re^4: RFC: The Poor Man's Accessor Filter

Replies are listed 'Best First'.
Re^5: RFC: The Poor Man's Accessor Filter
by rje (Deacon) on Oct 08, 2008 at 19:50 UTC
    I must admit I am often wary of CPAN packages which do a _lot_ of perhaps intrusive things in ways that I can't immediately grok. What's really going on? Add to that the need to learn the interface, which may not have been The Way I Would Have Done It, and so I start feeling a bit dizzy.

    At this point, though, I find myself dissatisfied with Perl's lack of a native mechanism for building accessor methods. For example, by your argument, does having Perl manage arrays for us will always leave some people with the question of what really goes on in the implementation? Of course not -- because it's in the core of Perl. Now that we've traipsed off the cliff's edge, we're in uncertain waters.

    At the same time, a well-written package should exist which is easy to use and understand -- does what's expected, doesn't Surprise us, is friendly, wags its tail, doesn't bite -- and so far, it looks like Class::BuildMethods is a good example of that.
      Perl has many native methods for building accessors. Your choice of using InsideOut Objects deliberately circumvent them. If you want to use native method building, use native objects.