SPUG: software libertarianism (was: Scope question)

Colin Meyer cmeyer at helvella.org
Fri Jun 14 22:20:51 CDT 2002

Hi Asim,

On Fri, Jun 14, 2002 at 06:47:53PM -0700, Asim Jalis wrote:
> Perl's permissiveness with object fields and also
> its lack of method prototyping makes changing the
> code a frightening experience. 

Aha! A simply stated problem where Perl falls short of other languages
for large projects.

I can certainly relate to this from the experience of maintaining own
code and others.

> The interpreter does not care if I change the
> number of parameters to a method and forget to fix
> some of the calls. 

To combat this problem, I like to code methods to take
named parameters.

  $mushroom->name( GENUS => 'Melanoleuca', 
                   SPECIES => 'verrucipes' );

The extra typing makes the fingers a tad wearier, but the code 
is easier to read later.  And this isn't much of a solution
to existing code, which there's plenty of.

> It also does not care if I
> rename a field in half my code but forget to
> rename it in a few places. 
> While there are some solutions to this they are
> all fat. Class::Multimethods and Class::Struct
> make classes slow and expensive to use. It would
> be nice if these features were supported in raw
> Perl through something like "use strict".

There's Tie::SecureHash. (Disclaimer: I haven't used it, other than
tinkering, but enjoyed the lecture at TPC a couple of years ago.) It's
model is run with slow, tied, very strict objects during devel and
testing; untie for speed at deployment.

Have fun,

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org

More information about the spug-list mailing list