[Glass] Variable - pointer classes, do you have them?

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Thu Sep 4 14:22:55 PDT 2014


Hi guys,

In Pharo, there are "variable" classes that hold pointers. That is, besides
the named instVars, there is a space for "variables". To create these
classes in Pharo we use variableSubclass:... etc...Example: Array.

ArrayedCollection variableSubclass: #Array
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Collections-Sequenceable'

So...to serialize these instances, what we do, is 2 things: serialize the
"fixed/named" instVars (none in this example of Array) and iterate and
serialize the "variable part" using #basicSize and #basicAt:. And then,
upon materialization, I can send #basicNew: with the desired size and using
#basicAt:put:

The way to get those classes in Pharo is:

Smalltalk allClasses select: [ :each | ((each isWeak not and: [ each
isFixed not ])  and: [ each isBytes not ]) and: [ each isPointers ] ]

->   an OrderedCollection(AbsolutePath AdditionalMethodState Array
BlockClosure Cubic FaFnSeries FaSeries FileReferenceTest MCMockClassE
MetacelloMethodSectionPath MetacelloVersionNumber MethodContext
MethodDictionary Path PathTest RelativePath SixxMockBinaryData
SixxMockMementoArray SixxMockVariableAlternativeClass
SixxMockVariableNewFailedClass SparseLargeArray SparseLargeTable
WAExampleClass WeakActionSequence)

Now I know in GemStone you have indexable classes. I think the equivalent
are those classes that answer true to #isPointers and #isIndexable


Smalltalk allClasses select: [:each | each isPointers and: [ each
isIndexable ] ]

-> [ anArray( Array, Collection, CompiledMethod, InvariantArray,
OldRepository, SequenceableCollection, SymbolList, AbstractCollisionBucket,
KeyValueDictionary, IntegerKeyValueDictionary, StringKeyValueDictionary,
CharacterCollection, ClusterBucketArray, ClassHistory, RcQueue,
StackBuffer, BtreeNode, BtreeInteriorNode, BtreeLeafNode,
BtreeBasicInteriorNode, BtreeBasicLeafNode, RcKeyValueDictionary,
RcIndexDictionary, RcIndexBucket, IdentityIndex, RangeEqualityIndex,
PathTerm, IndexList, DependencyList, SetValuedPathTerm, MappingInfo,
ConstrainedPathTerm, QueryExecuter, IdentityKeyValueDictionary,
PathEvaluator, OrderedCollection, SortedCollection, SortNode,
BasicSortNode, RcIndexBucketWithCache, GsMethod, ...)]

So..first question, is this assumption correct?   If true.... then which
methods can I use for what I need? that is, #basicSize, #basicAt: ,
#basicAt:put: , #basicNew:
I tried different combinations of #basicAt: , #_at: etc but it  never
worked.

What is strange for example, is that if I serialize these objects as FIXED
pointers...they seem to work. But the fixed part serializes only via
instVarNames... so I don't understand how this could work since I would be
missing the variable part.

Any help is appreciated.




-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20140904/f8452cd1/attachment.html>


More information about the Glass mailing list