Progammatically creating a pool dictionary - any problems?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Progammatically creating a pool dictionary - any problems?

Bill Schwab
Hello all,

Would any problems result from creating/modifying a PoolConstantsDictionary
in a class-side #initialize method?  At present, it looks as though the
class that owns/creates it is able to be unaware of its contents; the
dictionary is for users of the class to be able to easily reference arrayed
objects that it "serves".

Am I correct in thinking that I should resist the temptation to replace the
pool, and instead modify it in place?

Have a good one,

Bill


--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Progammatically creating a pool dictionary - any problems?

Blair McGlashan
Bill

You wrote in message news:99ns14$lo9$[hidden email]...
>
> Would any problems result from creating/modifying a
PoolConstantsDictionary
> in a class-side #initialize method?  At present, it looks as though the
> class that owns/creates it is able to be unaware of its contents; the
> dictionary is for users of the class to be able to easily reference
arrayed
> objects that it "serves".
>
> Am I correct in thinking that I should resist the temptation to replace
the
> pool, and instead modify it in place?

If you are using a PoolConstantsDictionary for the usual purpose (that is as
a source of constant values to be compiled into methods) then modifying or
replacing it at runtime will have no effect on any methods that were
previously compiled and which used constants from it. You might notice that
if you change a value in a PCD in the development environment that you get
prompted as to whether you wish all referencing methods to be recompiled,
and this is because the constant values get entered directly into the
literal frame of those methods. The point of a PCD, as opposed to a
PoolDictionary, is that the contents are supposed to be constant, and
therefore it is a reasonable optimization to copy those constant values. If
you use a PoolDictionary, on the other hand, then the variables themselves
are shared, not the values.

If you are not using the PoolConstantsDictionary as a repository for
constants for use from code, then probably you want another sort of
Dictionary or lookup table.

Regards

Blair