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

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Thu Sep 4 15:50:20 PDT 2014


Mariano,

I think that Interval should just be treated as an instance with three
instance variables. you should be able to use the instVarAt: and
instVarAt:put: methods ...

I am inclined to consider the odd behavior you are seeing as a bug and I
will submit an internal bug to have this looked into and/or explained ...

BTW, if you haven't already looked you might find implementors of
#basicWriteTo:,  #basicLoadFromNoRead:  and #basicLoadFromNoRead: size:
helpful as they are part of  passivation which is the native GemStone
serialization implementation ...

Thanks,

Dale


On Thu, Sep 4, 2014 at 2:39 PM, Mariano Martinez Peck via Glass <
glass at lists.gemtalksystems.com> wrote:

>
>
>
> On Thu, Sep 4, 2014 at 6:27 PM, Mariano Martinez Peck <
> marianopeck at gmail.com> wrote:
>
>> BTW...one of the examples I am trying to serialize/materialize in
>> Gemstone is Interval. And I cannot find a way to recreate them, neither via
>> #basicNew: or #_basicNew:
>>
>>
> I am trying the combination #basicSize, #_at:  , #_at:put  and #basicNew:
>
> However, creating an internal gives me something strange!
>
>
> (-10 to: 10 by: 5) basicSize -> 3
> (-10 to: 10 by: 5) _basicSize -> 0
>
> (Interval basicNew: 3) basicSize -> 6
> (Interval basicNew: 3) _basicSize -> 3
>
> And also I have another problem with (0 to: 0 by: 1).
>
> Anyway,..any clarification is appreciated.
>
> thoughts?
>
>
>
>> Thanks,
>>
>>
>> On Thu, Sep 4, 2014 at 6:22 PM, Mariano Martinez Peck <
>> marianopeck at gmail.com> wrote:
>>
>>> 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
>>>
>>
>>
>>
>> --
>> Mariano
>> http://marianopeck.wordpress.com
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20140904/b52a7d9f/attachment-0001.html>


More information about the Glass mailing list