package MInterface;
use strict;
use vars qw(
  @ISA
  
  %Namespaces
  %Elements
  
  %AttachmentsByObject
);
use MCoreTools;
use MInitializable;
@ISA = qw(MInitializable);

use MConnection;

# FIXME
*Namespaces = \%MConnection::Namespaces;
*Elements = \%MConnection::Elements;

# Internal documentation: instance variables
#   objects: hash of objects attached; keys are stringified refs; values are ref objects
#   connection: connection object this interface is associated with
#   prefs: like connection preferences

### Class methods #############################################################

sub _initialize {
  # ...move elements/namespaces stuff from MConnection
}

sub new {
  my ($class, $con) = @_;
  my $self = bless {
    connection => $con,
    objects => [],
    prefs => {},
  }, $class;
  return $self;
}

### Instance methods ##########################################################

sub objects {@{$_[0]{objects}}}
sub connection {$_[0]{connection}}

sub DESTROY {
  my ($self) = @_;
  mudlog "$self (".$self->{connection}->id.") destroyed";
}

1;
__END__
