[Glass] isBytes for fixed pointers but superclass with bytes

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

[Glass] isBytes for fixed pointers but superclass with bytes

GLASS mailing list
Hi guys,

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? 

Thoughts?

Thanks,  

--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] isBytes for fixed pointers but superclass with bytes

GLASS mailing list
Ok...I answer myself. Today I found #isBytesOrSpecial.


On Mon, Sep 1, 2014 at 11:09 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi guys,

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? 

Thoughts?

Thanks,  

--
Mariano
http://marianopeck.wordpress.com



--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] isBytes for fixed pointers but superclass with bytes

Richard Sargent
Administrator
In reply to this post by GLASS mailing list
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.
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] isBytes for fixed pointers but superclass with bytes

GLASS mailing list



On Tue, Sep 2, 2014 at 1:41 PM, Richard Sargent via Glass <[hidden email]> 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
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] isBytes for fixed pointers but superclass with bytes

GLASS mailing list
On Tue, Sep 2, 2014 at 10:47 AM, Mariano Martinez Peck <[hidden email]> wrote:



On Tue, Sep 2, 2014 at 1:41 PM, Richard Sargent via Glass <[hidden email]> 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
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



--
Mariano
http://marianopeck.wordpress.com


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] isBytes for fixed pointers but superclass with bytes

GLASS mailing list



On Tue, Sep 2, 2014 at 3:13 PM, Richard Sargent <[hidden email]> wrote:
On Tue, Sep 2, 2014 at 10:47 AM, Mariano Martinez Peck <[hidden email]> wrote:



On Tue, Sep 2, 2014 at 1:41 PM, Richard Sargent via Glass <[hidden email]> 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.


OK, that did the trick. 
Thanks for the help. 
 

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
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] isBytes for fixed pointers but superclass with bytes

GLASS mailing list
In reply to this post by GLASS mailing list
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) ... 

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

Dale


On Tue, Sep 2, 2014 at 11:13 AM, Richard Sargent via Glass <[hidden email]> wrote:
On Tue, Sep 2, 2014 at 10:47 AM, Mariano Martinez Peck <[hidden email]> wrote:



On Tue, Sep 2, 2014 at 1:41 PM, Richard Sargent via Glass <[hidden email]> 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
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



--
Mariano
http://marianopeck.wordpress.com


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] isBytes for fixed pointers but superclass with bytes

GLASS mailing list



On Tue, Sep 2, 2014 at 6:50 PM, Dale Henrichs <[hidden email]> 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 <[hidden email]> wrote:
On Tue, Sep 2, 2014 at 10:47 AM, Mariano Martinez Peck <[hidden email]> wrote:



On Tue, Sep 2, 2014 at 1:41 PM, Richard Sargent via Glass <[hidden email]> 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
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



--
Mariano
http://marianopeck.wordpress.com


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass





--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass