On Wed, 17 Sep 2003 11:55, Steve Purkis wrote;

  > Hmm, that's very similar in spirit to the 'classic' form.
  > 
  > Will generated accessors be overridable?  I can see how 'given' would 
  > be useful, but what if I wanted to say this:
  > 
  >         $grunt.name( "Patton" )
  >               .rank( "General" )
  >               .add_medal( "Purple heart" );

I just don't understand this.  What practical problem does this
arrangement solve?  I think it's highly counterintuitive and wasteful
of useful spaces for return values.

This is 10 times clearer:

    $grunt.set(name => "Patton",
               rank => "General");
    $grunt.add_medal("Purple heart");

No confusion, no scope for something going wrong when someone doesn't
return the original object in an accessor.

Also, I really think that methods which set values of an attribute,
rather than performing some kind of index lookup, ie

  my $attribute = $class->attribute("cheese");

It's fairly clear that you're fetching a value; in this case, "Foo" is
giving more information to the accessor.  However, what does this do?

  $class->attribute("price");

Does it set, or get (and ignore)?

Either of these are good IMHO:

  $class->set_attribute("value");
  $class->attribute = "value";

In both cases, it is 100% clear that the `$class' object it having its
`attribute' member updated.

Do have a look at the accessors generated by Class::Tangram objects,
I've put a lot of thought into the way code looks when you use the
default accessors.  I know that the interface to the module itself is
due for a fairly major overhaul, but try to look past that :).
-- 
Sam Vilain, [EMAIL PROTECTED]

"This is an object-oriented system.
 If we change anything, the users object." 


Reply via email to