A remark about 'field hashes'

Discussion in 'Perl Misc' started by Rainer Weikusat, Jun 18, 2013.

  1. I've had a closer look at this out of curiosity (beyond my initial
    assessment as 'useless module'): This is actually based on the idea to
    define a hash per 'object property' and use the 'object id' as index
    into the hash in order to obtain the value. Besides forcing users to
    use hashes for storing object properties (something some people
    presumably consider to be 'a feature') this means

    - every access to a property needs to turn the object into an
    object id and go through a 'gatekeeper abstraction' (which
    people who misunderstood the Java Beans specification as
    being concerned with objects accessing their own properties
    instead of objects accessing properties of other object
    presumably also consider a feature since it eliminates the
    advantages of the other approach)

    - the amount of work which needs to be performed when an
    object is destroyed is proportional to the number of
    properties

    - the amount of work which needs to be performed when creating
    a new ithread (IMHO not a good idea) is proportional to the
    number of objects times the number of fields

    - with a naive implementation, the same (uselessly) happens
    'during global destruction'

    IMO, a better idea is to use a package global hash to associate an
    object (via refaddr) with a hash or array reference and use that in
    the conventional way. This way, destroying a single object needs only
    a single deletion, the amount of work necessary to clone or terminate
    an interpreter is proportional to the number of objects and a method
    can use a single lookup/ function call to gain access to the 'state
    object' of the current instance and use that directly afterwards.
     
    Rainer Weikusat, Jun 18, 2013
    #1
    1. Advertising

  2. Rainer Weikusat <> writes:

    [...]

    > - the amount of work which needs to be performed when creating
    > a new ithread (IMHO not a good idea) is proportional to the
    > number of objects times the number of fields


    This should have been 'times the average number of fields per object'.
     
    Rainer Weikusat, Jun 19, 2013
    #2
    1. Advertising

  3. by defintion there is no such thing as self contained ensemble
     
    George Mpouras, Jun 19, 2013
    #3
    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. Ryan Mitchley
    Replies:
    0
    Views:
    413
    Ryan Mitchley
    Jul 19, 2004
  2. Tim O'Donovan

    Hash of hashes, of hashes, of arrays of hashes

    Tim O'Donovan, Oct 27, 2005, in forum: Perl Misc
    Replies:
    5
    Views:
    217
  3. Rainer Weikusat

    A remark

    Rainer Weikusat, Jun 11, 2012, in forum: Perl Misc
    Replies:
    2
    Views:
    623
    Rainer Weikusat
    Jun 11, 2012
  4. Rainer Weikusat

    a remark about 'stability'

    Rainer Weikusat, May 26, 2013, in forum: Perl Misc
    Replies:
    0
    Views:
    149
    Rainer Weikusat
    May 26, 2013
  5. Rainer Weikusat

    a remark about 'stability'

    Rainer Weikusat, May 26, 2013, in forum: Perl Misc
    Replies:
    3
    Views:
    152
    Rainer Weikusat
    May 27, 2013
Loading...

Share This Page