Implementation of Object>>#become: in VA 
Author Message
 Implementation of Object>>#become: in VA

I have noticed that the comments on the Object>>#become: method says
that the implementaiton of the method can vary on different platforms.
That is to say that in some cases it is one-way and that in others it
is two-way. Does this mean that the implementation varies on different
VA implementations or that it varies from different vendors such as
Dolphin or PPD?  In other words, can I depend that all VA
implementations will work like the NT one and be two way?  (I know
that this isn't a suggested method of accomplishing things but I'm
working on some low level infrastructure services where this will be a
BIG advantage).

Thanks.



Sat, 18 Sep 1999 03:00:00 GMT  
 Implementation of Object>>#become: in VA

Kent,

Both Inside Smalltalk (vol 1 p. 208) and Smalltalk-80: The Language
(the "purple book", p. 247) define the semantics of #become: as a
swap between the instance pointers of the receiver and the argument
object and vice-versa.

According to their documentation, VW implements this two-way swap,
whereas VA and Digitalk do instead only a one-way swap.

As for a variation in implementations across VA platforms, I'm not
qualified to say: perhaps someone knows how to access a VA forum that I
believe IBM has.

(A neat aside: Inside Smalltak describes the use of an 'indirection'
object, used in conjunction with #become: and #doesNotUnderstand: as a
means to monitor the messages sent to the intended receiver.)

Hope this helps.

: I have noticed that the comments on the Object>>#become: method says
: that the implementaiton of the method can vary on different platforms.
: That is to say that in some cases it is one-way and that in others it
: is two-way. Does this mean that the implementation varies on different
: VA implementations or that it varies from different vendors such as
: Dolphin or PPD?  In other words, can I depend that all VA
: implementations will work like the NT one and be two way?  (I know
: that this isn't a suggested method of accomplishing things but I'm
: working on some low level infrastructure services where this will be a
: BIG advantage).

: Thanks.
--
---

Calgary, Alberta     compuserve: 102526,1244



Mon, 20 Sep 1999 03:00:00 GMT  
 Implementation of Object>>#become: in VA


Quote:

>I have noticed that the comments on the Object>>#become: method says
>that the implementaiton of the method can vary on different platforms.
>That is to say that in some cases it is one-way and that in others it
>is two-way. Does this mean that the implementation varies on different
>VA implementations or that it varies from different vendors such as
>Dolphin or PPD?  In other words, can I depend that all VA
>implementations will work like the NT one and be two way?  (I know
>that this isn't a suggested method of accomplishing things but I'm
>working on some low level infrastructure services where this will be a
>BIG advantage).

Whoa! VA on NT does a TWO way #become:?  

Try this test and see what result you get. I don't doubt your observation
but I have not run into a VA or IBM/ST yet which does symmetric #become:s.

   " Determine which kind of become: is implemented "
   | a b |
   a := String with: $a.
   b := String with: $b.
   a become: b.
   a == b
      ifTrue:  [ ^ 'Asymmetric' ]
      ifFalse: [ ^ 'Symmetric' ]

I just tried this on Squeak which answered 'Symmetric' and an IBM
Smalltalk I had handy (not NT) which answered 'Asymmetric'.

Dave

_____________________________________________
David N. Smith
IBM T J Watson Research Center, Hawthorne, NY

Home Page: http://www.dnsmith.com/
_____________________________________________
Any opinions or recommendations are those
of the author and not of his employer.



Mon, 20 Sep 1999 03:00:00 GMT  
 Implementation of Object>>#become: in VA



Quote:
>Whoa! VA on NT does a TWO way #become:?  

>Try this test and see what result you get. I don't doubt your observation
>but I have not run into a VA or IBM/ST yet which does symmetric #become:s.

>   " Determine which kind of become: is implemented "
>   | a b |
>   a := String with: $a.
>   b := String with: $b.
>   a become: b.
>   a == b
>      ifTrue:  [ ^ 'Asymmetric' ]
>      ifFalse: [ ^ 'Symmetric' ]

Sorry, I got a bit ahead of myself on this one and found out
afterwards that I was only partly right on the two-way. What really
happens is that the #become: operation returns the the original.

 | x y z|
 x := 'X'.
 y := 'Y'.
 z := x become: y.
 Transcript show: x,y,z;cr.

results in
YYZ.

The important part here is that you can maintain a reference to the
original value of x which is actually more useful in creating an
indirection object than a two way.



Tue, 21 Sep 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Interesting problem with Object>>become: please help

2. Object>>become: in ParcPlace ST

3. HELP>>>>>>>Fortran-Pascal Linking

4. >>>>>>>FROM SMTK TO C++

5. ><><><><>Heeeeeeeeeeeeeeelp on INT 14!><><><><><>

6. <<<<<YOU MUST CHECK THIS OUT >>>>>>>>>> 2103

7. >>>>>AVL tree

8. >>>>>How to read a IMAGE file?(BMP, GIF)|||||||||

9. ANNOUNCE>>>>>TOTAL FrameWork from Cincom

10. Slow/No Speed>>>>>>>>>

11. HELP:>>Problems with VA 3.0a CwTextPrompter

12. VA 4.5 >> Container Details Tree

 

 
Powered by phpBB® Forum Software