[Glass] isBytes for fixed pointers but superclass with bytes

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Tue Sep 2 18:49:43 PDT 2014


On Tue, Sep 2, 2014 at 6:50 PM, Dale Henrichs <
dale.henrichs at gemtalksystems.com> wrote:

> Richard/Mariano,
>
> I believe that you can use #_at: to grab values from an NSC - you can see
> it's use in #_select: and freinds ... it is worth mentioning at this point
> in time that method beginning with '_' are considered private gemstone
> methods and we reserve the right to change the behavior of such methods
> without warning (including dropping them from the image) ...
>
>
Dale, I tried that before sending this email, same as _basicAt: etc...
still get an error. Example:

Bag new add: 1; add: 2; _at: 1

The only way I found is Richard one, that is, using #do:.


> sometimes an '_' method is the only way to do some things especially in
> the world of Fuel:)
>

Exactly, that's what I found :)



>
> Dale
>
>
> On Tue, Sep 2, 2014 at 11:13 AM, Richard Sargent via Glass <
> glass at lists.gemtalksystems.com> wrote:
>
>> On Tue, Sep 2, 2014 at 10:47 AM, Mariano Martinez Peck <
>> marianopeck at gmail.com> wrote:
>>
>>>
>>>
>>>
>>> On Tue, Sep 2, 2014 at 1:41 PM, Richard Sargent via Glass <
>>> glass at lists.gemtalksystems.com> wrote:
>>>
>>>> GLASS mailing list wrote
>>>> > In pharo, we don't have a class defined as "fixed pointers" with a
>>>> "bytes"
>>>> > superclass. The following expression is empty in Pharo:
>>>> >
>>>> > Smalltalk allClasses select: [ :each | (each isBytes and: [ each
>>>> > allSubclasses size > 0 ])
>>>> > and: [ each allSubclasses anySatisfy:  [ :aSubClass | aSubClass
>>>> isBytes
>>>> > not
>>>> >  ] ]
>>>> >  ]
>>>> >
>>>> > But in GemStone I have 2 exceptions:
>>>> >
>>>> > anArray( AbstractCharacter, Float)
>>>> >
>>>> > To me...it looks very strange that, for example, SmallDouble answers
>>>> false
>>>> > to #isBytes. So I wonder.....since these are very strange scenarios,
>>>> as a
>>>> > simple workaround, could we implement the correct #isBytes,
>>>> #isVariable
>>>> > etc
>>>> > for those particular subclasses?
>>>>
>>>> implementationFormat
>>>>
>>>> "Returns the three least-significant bits of the receiver's format
>>>> instance
>>>>  variable.  The values of those bits mean the following:
>>>>
>>>>  0   OOP       non-indexable
>>>>  1   Byte      non-indexable
>>>>  2   NSC       non-indexable
>>>>  3   Special   non-indexable
>>>>  4   OOP       indexable
>>>>  5   Byte      indexable"
>>>>
>>>> ^ format bitAnd: 16r7
>>>>
>>>>
>>>> If you inspect the format of these classes, you will see they are
>>>> specials.
>>>> Their oop fully defines each object. Questions like #isBytes is more
>>>> meaningful (and useful) when addressed to things like collections.
>>>>
>>>>
>>>>
>>> Thanks Richard, #implementationFormat was useful. Now I have a doubt
>>> with NSC. They answer true to #isVariable. However, I cannot seem to find a
>>> way to iterate its "variable" (not regular pointer slots). For example, in
>>> Pharo, I can do:
>>>
>>> 1 to: anObject basicSize
>>> do: [ :index | aBlock value: (anObject basicAt: index) ]
>>>  How can I do that for a NSC, say Bag? Do I need to iterate it's
>>> instVars as a regular OOP non-indexeable?  (instVarNames...etc...).
>>>
>>
>> A Non-sequenceable Collection (NSC) is represented by internal GemStone
>> data structures. It's instance variables won't get you anywhere. It looks
>> like you will need to use #do: and just iterate over its contents.
>>
>>
>>> Thanks,
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://forum.world.st/Glass-isBytes-for-fixed-pointers-but-superclass-with-bytes-tp4775703p4775819.html
>>>> Sent from the GLASS mailing list archive at Nabble.com.
>>>> _______________________________________________
>>>> Glass mailing list
>>>> Glass at lists.gemtalksystems.com
>>>> http://lists.gemtalksystems.com/mailman/listinfo/glass
>>>>
>>>
>>>
>>>
>>> --
>>> Mariano
>>> http://marianopeck.wordpress.com
>>>
>>
>>
>> _______________________________________________
>> Glass mailing list
>> Glass at lists.gemtalksystems.com
>> http://lists.gemtalksystems.com/mailman/listinfo/glass
>>
>>
>


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


More information about the Glass mailing list