Two remarks about the Perl object model

Discussion in 'Perl Misc' started by Rainer Weikusat, Aug 22, 2012.

  1. Negative one first: Destructors of superclasses aren't executed
    automatically when an instance of a subclass with a destructor of its
    own is destroyed. This implies that, in order to derive a class from
    some other class, knowledge about the implementation of all ancestors
    of the new class is required because a suitable order and mechanism to
    cause superclass destructors to be executed needs to be worked out.

    The positive one: A class is created by associating a reference to an
    object of some type with a package. This is accomplished by calling
    the bless-subroutine with suitable arguments. Because this is just an
    ordinary runtime-operation, references which are already blessed into
    a particular package can be 're-blessed' into a different package in
    order to become an instance of a different class.

    Example where this is useful: For a 'firewall-configuring application'
    I need to manage sets of 'IP addresses' which are composed of objects
    representing a single address and objects representing an address
    range. An operation I need to perform on two such sets is to do an
    ordered merge of them. This requires being able to merge any two
    objects making up a continuous range into an equivalent, single range
    object. If I can do destructive merging (usual case), this is
    implemented by calling a method named change_addrs on the object
    'containing' the new end-address of the combined range. If this
    happens to be an object representing a single address, the method
    transparently morphs that into a range object.
    Rainer Weikusat, Aug 22, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MattB

    remarks in Intellisense

    MattB, Sep 7, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    2,197
    Greg Burns
    Sep 7, 2004
  2. Replies:
    6
    Views:
    1,297
    Gennaro Prota
    Jun 28, 2007
  3. Michael S. Scherotter

    <remarks/> in proxy classes

    Michael S. Scherotter, Feb 15, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    124
    Michael S. Scherotter
    Feb 15, 2006
  4. Onideus Mad Hatter

    Hrmmm...Suggestions, Ideas, Pointless Remarks?

    Onideus Mad Hatter, Jul 3, 2005, in forum: Javascript
    Replies:
    14
    Views:
    184
    Thomas 'PointedEars' Lahn
    Jul 16, 2005
  5. Rainer Weikusat

    some random remarks about Moose::Manual::Concepts

    Rainer Weikusat, Mar 2, 2013, in forum: Perl Misc
    Replies:
    12
    Views:
    366
    Steve May
    Mar 7, 2013
Loading...

Share This Page