Instance Flyweight Pattern

The InstanceFlyweightPattern is an extreme form of the FlyweightPattern.

    #!/usr/bin/env perl
    package Integer;
    { my %ints;
     sub new {
        my $class = shift;
        my $self;
        unless(exists($self = $ints{$_[0]})){
             $self = bless {'int' => $_[0]}, $class;
        }
        $self;
     }
    }


CategoryPattern


EditText of this page (last edited April 4, 2010) or FindPage with title or text search