On Mon, Nov 7, 2011 at 12:39 PM, Aristotle Pagaltzis <pagalt...@gmx.de>wrote:

> * Trystan <trysta...@gmail.com> [2011-11-06 23:30]:
> > I found this idea in Head First
> > OOA&D<http://headfirstlabs.com/books/hfooad/>, chapter 5. It's
> > somewhat like a very simple version of Key-Value
> > Coding<
> http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/Overview.html%23//apple_ref/doc/uid/20001838-SW1
> >.
> > It's also very similar to
> > Object::Generic<
> http://search.cpan.org/%7Ejmahoney/Object-Generic-0.13/lib/Object/Generic.pm
> >but
> > I didn't use AUTOLOAD and I implemented 'equals' and 'contains'
> > methods in order to make the objects searchable within a container.
> >
> > Here's an example:
> >
> >  my $a = tbd_name::Object->new();
> >  my $b = tbd_name::Object->new();
> >
> >  $a->set( "ID", tbd_name::String->new("1234a") );
> >  $b->set( "ID", tbd_name::String->new("1234a") );
> >
> >  print $a->get("ID");
> >
> >  $a->equals($b) ? print "yes";
> >
> >  $container = tbd_name::List->new();
> >  $container->add($a);
> >
> >  $container->search($b);  #which returns $a
> >
> > What do I call this thing?
>
> Uhm. So when would I ever use this over a simple hash?
>

Reply via email to