[Glass] isBytes for fixed pointers but superclass with bytes

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Tue Sep 2 10:47:04 PDT 2014


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...).

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20140902/ec1bb5a5/attachment.html>


More information about the Glass mailing list