[vwnc] per instance behaviour in VW ?

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

[vwnc] per instance behaviour in VW ?

Martin Rubi-2
Hi. I'm wondering if there is a package out there for VW which would allow me to define per instance behaviour for an object.
If there isn't a public package, then I would be interested in hearing possible approaches to do that in VW. For instance, in Dolphin I used to do that using a goodie which would change the object's class to an anonymous class, and then modifying methods in that class. I'm sure VW already has something like that, but I don't know where to look for it.
 
thanks in advance
martin

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Boris Popov, DeepCove Labs (SNN)
Depending on your needs, you could just store custom action blocks in
ivars on your objects...

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message header.
Unless otherwise indicated, it contains information that is private and
confidential. If you have received it in error, please notify the sender
and delete the entire message including any attachments.

Thank you.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Martin Rubi
Sent: August 28, 2008 10:07 AM
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?

Hi. I'm wondering if there is a package out there for VW which would
allow me to define per instance behaviour for an object.
If there isn't a public package, then I would be interested in hearing
possible approaches to do that in VW. For instance, in Dolphin I used to
do that using a goodie which would change the object's class to an
anonymous class, and then modifying methods in that class. I'm sure VW
already has something like that, but I don't know where to look for it.
 
thanks in advance
martin

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Terry Raymond
In reply to this post by Martin Rubi-2

There was something called lightweight classes that would do what

you want. They can be found in a package called ObjectDebugging

at the Smalltalk archives. Unfortunately, I don’t think you can get

to them anymore.

 

ObjectDebugging
        Adds a new concept to the ST-80 programming environment:  
        lightweight classes.  Lightweight classes are a new kind of Behavior that 

            allow specific behavior on a per-instance basis.

 

This was originally available in ObjectWorks 4.1 and VW 2.0.

Terry

===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================


From: [hidden email] [mailto:[hidden email]] On Behalf Of Martin Rubi
Sent: Thursday, August 28, 2008 1:07 PM
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?

 

Hi. I'm wondering if there is a package out there for VW which would allow me to define per instance behaviour for an object.

If there isn't a public package, then I would be interested in hearing possible approaches to do that in VW. For instance, in Dolphin I used to do that using a goodie which would change the object's class to an anonymous class, and then modifying methods in that class. I'm sure VW already has something like that, but I don't know where to look for it.

 

thanks in advance

martin


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Martin Rubi
In reply to this post by Boris Popov, DeepCove Labs (SNN)
Boris,
I want to use it to extend tests with the ability of changing some specific object's behaviour. Something like this:
 
-----------
 
TestSomething>>testHandlingAPrivateConnectionFailureDuringAPublicOperation
    "Test that if during some public operation of SomeObject the private connection fails, something happens"
 
    | someObject |
 
    someObject := SomeObject new.
 
    self
        when: someObject
        receives: #connectToSomethingThatCouldFail
        do: [:receiver :arguments | LowLevelConnectionError raiseSignal: 'This is an emulated low level connection error'].
 
    self
        should: [someObject publicOperationThatPrivatelyConnectsToSomething]
        raise: SomeSpecificError.
 
-----------
or this simplier pattern:
 
    connectionToAFakeResourceForTesting := self connectionToAFakeResource.
    self
        when: anObject
        receives: #newConnection
        answer: connectionToAFakeResourceForTesting.
 
-----------
 
I know this sort of tests can be done with mocks as well, but I found this approach simplier and clearer (to my personal taste, do not take this as general statement). Anyway, this is why I would like to change the behaviour of a specific method of a specific instance of an arbitrary class, without having proxies "self problem".
 
Any ideas will be appreciated,
regards
martin
 
----- Original Message -----
Sent: Thursday, August 28, 2008 2:38 PM
Subject: Re: [vwnc] per instance behaviour in VW ?

Depending on your needs, you could just store custom action blocks in
ivars on your objects...

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message header.
Unless otherwise indicated, it contains information that is private and
confidential. If you have received it in error, please notify the sender
and delete the entire message including any attachments.

Thank you.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Martin Rubi
Sent: August 28, 2008 10:07 AM
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?

Hi. I'm wondering if there is a package out there for VW which would
allow me to define per instance behaviour for an object.
If there isn't a public package, then I would be interested in hearing
possible approaches to do that in VW. For instance, in Dolphin I used to
do that using a goodie which would change the object's class to an
anonymous class, and then modifying methods in that class. I'm sure VW
already has something like that, but I don't know where to look for it.
 
thanks in advance
martin

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Martin Rubi-2

I've used conditional method wrappers for that with instance identity check.

Cheers!

-Boris (via BlackBerry)


From: Martin Rubi
To: Boris Popov; [hidden email]
Sent: Thu Aug 28 11:30:04 2008
Subject: Re: [vwnc] per instance behaviour in VW ?

Boris,
I want to use it to extend tests with the ability of changing some specific object's behaviour. Something like this:
 
-----------
 
TestSomething>>testHandlingAPrivateConnectionFailureDuringAPublicOperation
    "Test that if during some public operation of SomeObject the private connection fails, something happens"
 
    | someObject |
 
    someObject := SomeObject new.
 
    self
        when: someObject
        receives: #connectToSomethingThatCouldFail
        do: [:receiver :arguments | LowLevelConnectionError raiseSignal: 'This is an emulated low level connection error'].
 
    self
        should: [someObject publicOperationThatPrivatelyConnectsToSomething]
        raise: SomeSpecificError.
 
-----------
or this simplier pattern:
 
    connectionToAFakeResourceForTesting := self connectionToAFakeResource.
    self
        when: anObject
        receives: #newConnection
        answer: connectionToAFakeResourceForTesting.
 
-----------
 
I know this sort of tests can be done with mocks as well, but I found this approach simplier and clearer (to my personal taste, do not take this as general statement). Anyway, this is why I would like to change the behaviour of a specific method of a specific instance of an arbitrary class, without having proxies "self problem".
 
Any ideas will be appreciated,
regards
martin
 
----- Original Message -----
Sent: Thursday, August 28, 2008 2:38 PM
Subject: Re: [vwnc] per instance behaviour in VW ?

Depending on your needs, you could just store custom action blocks in
ivars on your objects...

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message header.
Unless otherwise indicated, it contains information that is private and
confidential. If you have received it in error, please notify the sender
and delete the entire message including any attachments.

Thank you.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Martin Rubi
Sent: August 28, 2008 10:07 AM
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?

Hi. I'm wondering if there is a package out there for VW which would
allow me to define per instance behaviour for an object.
If there isn't a public package, then I would be interested in hearing
possible approaches to do that in VW. For instance, in Dolphin I used to
do that using a goodie which would change the object's class to an
anonymous class, and then modifying methods in that class. I'm sure VW
already has something like that, but I don't know where to look for it.
 
thanks in advance
martin

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Martin Rubi
In reply to this post by Terry Raymond
Terry,
thanks for the info.
I just found that Hernan Morales made a port to VW 7.3 in http://cs.hernanmorales.com.ar/lc-vw.php.
I think that's what I was looking for.
 
Thank you very much to all of you.
regards
martin
 
----- Original Message -----
Sent: Thursday, August 28, 2008 3:19 PM
Subject: Re: [vwnc] per instance behaviour in VW ?

There was something called lightweight classes that would do what

you want. They can be found in a package called ObjectDebugging

at the Smalltalk archives. Unfortunately, I don’t think you can get

to them anymore.

 

“

ObjectDebugging
        Adds a new concept to the ST-80 programming environment:  
        lightweight classes.  Lightweight classes are a new kind of Behavior that 

            allow specific behavior on a per-instance basis.

“

 

This was originally available in ObjectWorks 4.1 and VW 2.0.

Terry

===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================


From: [hidden email] [mailto:[hidden email]] On Behalf Of Martin Rubi
Sent: Thursday, August 28, 2008 1:07 PM
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?

 

Hi. I'm wondering if there is a package out there for VW which would allow me to define per instance behaviour for an object.

If there isn't a public package, then I would be interested in hearing possible approaches to do that in VW. For instance, in Dolphin I used to do that using a goodie which would change the object's class to an anonymous class, and then modifying methods in that class. I'm sure VW already has something like that, but I don't know where to look for it.

 

thanks in advance

martin


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Terry Raymond

Martin

 

Yup, that looks like it.

 

You might suggest to him that it also be published to the public

Store repository.

 

Terry

===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================


From: Martin Rubi [mailto:[hidden email]]
Sent: Thursday, August 28, 2008 3:21 PM
To: Terry Raymond; [hidden email]
Subject: Re: [vwnc] per instance behaviour in VW ?

 

Terry,

thanks for the info.

I just found that Hernan Morales made a port to VW 7.3 in http://cs.hernanmorales.com.ar/lc-vw.php.

I think that's what I was looking for.

 

Thank you very much to all of you.

regards

martin

 

----- Original Message -----

Sent: Thursday, August 28, 2008 3:19 PM

Subject: Re: [vwnc] per instance behaviour in VW ?

 

There was something called lightweight classes that would do what

you want. They can be found in a package called ObjectDebugging

at the Smalltalk archives. Unfortunately, I don’t think you can get

to them anymore.

 

ObjectDebugging
        Adds a new concept to the ST-80 programming environment:  
        lightweight classes.  Lightweight classes are a new kind of Behavior that 

            allow specific behavior on a per-instance basis.

 

This was originally available in ObjectWorks 4.1 and VW 2.0.

Terry

===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================


From: [hidden email] [mailto:[hidden email]] On Behalf Of Martin Rubi
Sent: Thursday, August 28, 2008 1:07 PM
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?

 

Hi. I'm wondering if there is a package out there for VW which would allow me to define per instance behaviour for an object.

If there isn't a public package, then I would be interested in hearing possible approaches to do that in VW. For instance, in Dolphin I used to do that using a goodie which would change the object's class to an anonymous class, and then modifying methods in that class. I'm sure VW already has something like that, but I don't know where to look for it.

 

thanks in advance

martin


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Travis Griggs-3
In reply to this post by Martin Rubi
Rolling your own is pretty easy too. Here's an example:

| list |
list := OrderedCollection new.
list add: 42.
Transcript print: list; cr; endEntry.
list changeClassTo: (list class copy superclass: list class).
list class compile: 'add: anObject ^super remove: anObject'.
list add: 42.
Transcript print: list; cr; endEntry.

The first 4 lines just create a normal object and output it. The next  
line makes it have a lightweight class,  line after that makes it so  
that add: turns into remove:. And the last 2 demonstrate that it worked.

--
Travis Griggs
Objologist
"Only one thing is impossible for God: to find any sense in any  
copyright law on the planet." - Mark Twain


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Stefan Schmiedl
On Thu, 28 Aug 2008 15:48:30 -0700
Travis Griggs <[hidden email]> wrote:

> Rolling your own is pretty easy too. Here's an example:
>
> | list |
> list := OrderedCollection new.
> list add: 42.
> Transcript print: list; cr; endEntry.
> list changeClassTo: (list class copy superclass: list class).
> list class compile: 'add: anObject ^super remove: anObject'.
> list add: 42.
> Transcript print: list; cr; endEntry.
>
> The first 4 lines just create a normal object and output it. The next  
> line makes it have a lightweight class,  line after that makes it so  
> that add: turns into remove:. And the last 2 demonstrate that it worked.
>

What's the weight of a class name?

IOW, why is the class constructed by

        list class copy superclass: list class

lightweight with respect to a "normal" class?

just making smalltalk,
s.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Travis Griggs-3

On Aug 29, 2008, at 1:11 AM, Stefan Schmiedl wrote:

> On Thu, 28 Aug 2008 15:48:30 -0700
> Travis Griggs <[hidden email]> wrote:
>
>> Rolling your own is pretty easy too. Here's an example:
>>
>> | list |
>> list := OrderedCollection new.
>> list add: 42.
>> Transcript print: list; cr; endEntry.
>> list changeClassTo: (list class copy superclass: list class).
>> list class compile: 'add: anObject ^super remove: anObject'.
>> list add: 42.
>> Transcript print: list; cr; endEntry.
>>
>> The first 4 lines just create a normal object and output it. The next
>> line makes it have a lightweight class,  line after that makes it so
>> that add: turns into remove:. And the last 2 demonstrate that it  
>> worked.
>>
>
> What's the weight of a class name?
>
> IOW, why is the class constructed by
>
> list class copy superclass: list class
>
> lightweight with respect to a "normal" class?
>
> just making smalltalk,

Normally, a class is aware of it's subclasses. And aware of its  
superclass, thus forming a doubly linked graph. By knowing 'Class  
rootsOfTheWorld' then, you can find all "first class" classes, by  
traversing all subclasses. These are classes that you can refer to by  
name, that can be bound into a method. And that often, other objects  
(such as SystemOrganizers) may be aware of. Short of it is, there are  
quite a few references that make it long lived.

The copy otoh, becomes aware of its superclass (so it can use all the  
former methods through inheritence), but the original, has no idea a  
new "subclass" of it exists. So when no instances are alive with a  
class pointer referencing this thing, it will be GCed. Also there is  
no way to get at this class object, unless you can find the instance  
of it. This is why it is said to be "lightweight".

--
Travis Griggs
Objologist
"Is success the potential of what could be, or the reality of what is?"


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Stefan Schmiedl
On Fri, 29 Aug 2008 09:27:05 -0700
Travis Griggs <[hidden email]> wrote:

> ... This is why it is said to be "lightweight".

Thank you for the succinct explanation, Travis.

s.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Stew MacLean
In reply to this post by Martin Rubi-2

Hi Martin,

 

Funnily enough, I’ve just dug this out for a tricky debugging problem in VisualAge.

 

Please find attached the application and some documentation.

 

The user interface will be different, but the same meta code should be adaptable.

 

HTH - Cheers,

 

Stewart

 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Martin Rubi
Sent: 29 August 2008 5:07 a.m.
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?

 

Hi. I'm wondering if there is a package out there for VW which would allow me to define per instance behaviour for an object.

If there isn't a public package, then I would be interested in hearing possible approaches to do that in VW. For instance, in Dolphin I used to do that using a goodie which would change the object's class to an anonymous class, and then modifying methods in that class. I'm sure VW already has something like that, but I don't know where to look for it.

 

thanks in advance

martin


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

DimInstanceSpecializationApp.app (23K) Download Attachment
readme.zip (217K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Stew MacLean
In reply to this post by Martin Rubi-2

Hi Martin,

 

Funnily enough, I’ve just dug this out for a tricky debugging problem in VisualAge.

 

Please find attached the application and some documentation (sorry, not attached as exceeded size limit – please email me if you’re interested).

 

The user interface will be different, but the same meta code should be adaptable.

 

HTH - Cheers,

 

Stewart

 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Martin Rubi
Sent: 29 August 2008 5:07 a.m.
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?

 

Hi. I'm wondering if there is a package out there for VW which would allow me to define per instance behaviour for an object.

If there isn't a public package, then I would be interested in hearing possible approaches to do that in VW. For instance, in Dolphin I used to do that using a goodie which would change the object's class to an anonymous class, and then modifying methods in that class. I'm sure VW already has something like that, but I don't know where to look for it.

 

thanks in advance

martin


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

DimInstanceSpecializationApp.app (23K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

David Caster
Stewart,

Can you share with us what the nature of the VAST defect is that you are chasing with the aid of this facility?  It might be helpful to learn how you are using per-instance behavior to help out with this kind of thing.

Best,
David C'

On Sep 3, 2008, at 3:32 PM, Stewart MacLean wrote:

Hi Martin,
 
Funnily enough, I’ve just dug this out for a tricky debugging problem in VisualAge.
 
Please find attached the application and some documentation (sorry, not attached as exceeded size limit – please email me if you’re interested).
 
The user interface will be different, but the same meta code should be adaptable.
 
HTH - Cheers,
 
Stewart
 
-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of Martin Rubi
Sent: 29 August 2008 5:07 a.m.
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?
 
Hi. I'm wondering if there is a package out there for VW which would allow me to define per instance behaviour for an object.
If there isn't a public package, then I would be interested in hearing possible approaches to do that in VW. For instance, in Dolphin I used to do that using a goodie which would change the object's class to an anonymous class, and then modifying methods in that class. I'm sure VW already has something like that, but I don't know where to look for it.
 
thanks in advance
martin
<DimInstanceSpecializationApp.app>
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Stew MacLean
In reply to this post by Martin Rubi-2

Sorry for the ambiguity – it’s not a problem in VAST itself, but in a complex application written in VAST.

 

I’ve got to analyse code (written last century in 93) that consolidates object trees, so as to make it work with a revised underlying model.

 

I use the instance specific behaviour to insert halts on particular objects to break in and see what’s going on. For example, as the code breaks encapsulation by accessing collections and adding to them, it’s handy to trap OrderedCollection<<add: on a specific object.

 

Cheers,

 

Stewart

 

 

-----Original Message-----
From: David Caster [mailto:[hidden email]]
Sent:
4 September 2008 11:11 a.m.
To: [hidden email]
Subject: Re: [vwnc] per instance behaviour in VW ?

 

Stewart,

 

Can you share with us what the nature of the VAST defect is that you are chasing with the aid of this facility?  It might be helpful to learn how you are using per-instance behavior to help out with this kind of thing.

 

Best,

David C'

 

On Sep 3, 2008, at 3:32 PM, Stewart MacLean wrote:



Hi Martin,

 

Funnily enough, I’ve just dug this out for a tricky debugging problem in VisualAge.

 

Please find attached the application and some documentation (sorry, not attached as exceeded size limit – please email me if you’re interested).

 

The user interface will be different, but the same meta code should be adaptable.

 

HTH - Cheers,

 

Stewart

 

-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of Martin Rubi
Sent: 
29 August 2008 5:07 a.m.
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?

 

Hi. I'm wondering if there is a package out there for VW which would allow me to define per instance behaviour for an object.

If there isn't a public package, then I would be interested in hearing possible approaches to do that in VW. For instance, in Dolphin I used to do that using a goodie which would change the object's class to an anonymous class, and then modifying methods in that class. I'm sure VW already has something like that, but I don't know where to look for it.

 

thanks in advance

martin

<DimInstanceSpecializationApp.app>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Martin Rubi
In reply to this post by Stew MacLean
Stewart,
it's a great article.
Anyway, after failing to install lightweight classes into 7.6, I ported
Chris Uppal's "CU Object Methods'' goodie for Dolphin. It's almost the same
as what you describe, but with no UI and the couple of methods I wanted to
add to TestCase. I think there are a few details to fix, though, such as
making a copy of the specialized class metaclass (something that was in the
original Chris's package, by the way, it's my fault it's missing in the
port), but I can get away with it for the moment.
Thanks to everybody one more time. By the way, if somebody wants to get the
bundle just let me know and I'll send it.

regards
martin

----- Original Message -----
From: Stewart MacLean
To: [hidden email]
Sent: Wednesday, September 03, 2008 7:32 PM
Subject: Re: [vwnc] per instance behaviour in VW ?


Hi Martin,

Funnily enough, I've just dug this out for a tricky debugging problem in
VisualAge.

Please find attached the application and some documentation (sorry, not
attached as exceeded size limit - please email me if you're interested).

The user interface will be different, but the same meta code should be
adaptable.

HTH - Cheers,

Stewart

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf
Of Martin Rubi
Sent: 29 August 2008 5:07 a.m.
To: [hidden email]
Subject: [vwnc] per instance behaviour in VW ?

Hi. I'm wondering if there is a package out there for VW which would allow
me to define per instance behaviour for an object.
If there isn't a public package, then I would be interested in hearing
possible approaches to do that in VW. For instance, in Dolphin I used to do
that using a goodie which would change the object's class to an anonymous
class, and then modifying methods in that class. I'm sure VW already has
something like that, but I don't know where to look for it.

thanks in advance
martin



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc 

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Stephen Pope

Hello all,

I haven't followed this thread, but Siren does indeed support instance-
specific behavior -- it's pretty easy using DNU.

stp

--
    Stephen Travis Pope  --  Santa Barbara, California, USA
    http://HeavenEverywhere.com     http://FASTLabInc.com
 
 



On Sep 4, 2008, at 11:28 AM, Martin Rubi wrote:

> Stewart,
> it's a great article.
> Anyway, after failing to install lightweight classes into 7.6, I  
> ported
> Chris Uppal's "CU Object Methods'' goodie for Dolphin. It's almost  
> the same
> as what you describe, but with no UI and the couple of methods I  
> wanted to
> add to TestCase. I think there are a few details to fix, though,  
> such as
> making a copy of the specialized class metaclass (something that was  
> in the
> original Chris's package, by the way, it's my fault it's missing in  
> the
> port), but I can get away with it for the moment.
> Thanks to everybody one more time. By the way, if somebody wants to  
> get the
> bundle just let me know and I'll send it.
>
> regards
> martin
>
> ----- Original Message -----
> From: Stewart MacLean
> To: [hidden email]
> Sent: Wednesday, September 03, 2008 7:32 PM
> Subject: Re: [vwnc] per instance behaviour in VW ?
>
>
> Hi Martin,
>
> Funnily enough, I've just dug this out for a tricky debugging  
> problem in
> VisualAge.
>
> Please find attached the application and some documentation (sorry,  
> not
> attached as exceeded size limit - please email me if you're  
> interested).
>
> The user interface will be different, but the same meta code should be
> adaptable.
>
> HTH - Cheers,
>
> Stewart
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On  
> Behalf
> Of Martin Rubi
> Sent: 29 August 2008 5:07 a.m.
> To: [hidden email]
> Subject: [vwnc] per instance behaviour in VW ?
>
> Hi. I'm wondering if there is a package out there for VW which would  
> allow
> me to define per instance behaviour for an object.
> If there isn't a public package, then I would be interested in hearing
> possible approaches to do that in VW. For instance, in Dolphin I  
> used to do
> that using a goodie which would change the object's class to an  
> anonymous
> class, and then modifying methods in that class. I'm sure VW already  
> has
> something like that, but I don't know where to look for it.
>
> thanks in advance
> martin
>
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

pastedGraphic.tiff (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Thomas Gagné-2
In reply to this post by Travis Griggs-3
I know I'm way late on this thread, but when I tried using lightweight
(anonymous) classes before, one of the annoying things about them was
their creation was logged in the changes file.  At the rate I wanted to
create them this would have made for a fairly unruly changes file.  My
attempts to create the classes without the logging were unsuccessful.

Anyway, I think it would be an interesting thing to have an
implementation of anonymous classes without logging--making them about
as light-weight as you can get.  Very interesting possibilities for
manipulating data coming from external sources about which little
(certain) is known.

Travis Griggs wrote:

> On Aug 29, 2008, at 1:11 AM, Stefan Schmiedl wrote:
>
>  
>> On Thu, 28 Aug 2008 15:48:30 -0700
>> Travis Griggs <[hidden email]> wrote:
>>
>>    
>>> Rolling your own is pretty easy too. Here's an example:
>>>
>>> | list |
>>> list := OrderedCollection new.
>>> list add: 42.
>>> Transcript print: list; cr; endEntry.
>>> list changeClassTo: (list class copy superclass: list class).
>>> list class compile: 'add: anObject ^super remove: anObject'.
>>> list add: 42.
>>> Transcript print: list; cr; endEntry.
>>>
>>> The first 4 lines just create a normal object and output it. The next
>>> line makes it have a lightweight class,  line after that makes it so
>>> that add: turns into remove:. And the last 2 demonstrate that it  
>>> worked.
>>>
>>>      
>> What's the weight of a class name?
>>
>> IOW, why is the class constructed by
>>
>> list class copy superclass: list class
>>
>> lightweight with respect to a "normal" class?
>>
>> just making smalltalk,
>>    
>
> Normally, a class is aware of it's subclasses. And aware of its  
> superclass, thus forming a doubly linked graph. By knowing 'Class  
> rootsOfTheWorld' then, you can find all "first class" classes, by  
> traversing all subclasses. These are classes that you can refer to by  
> name, that can be bound into a method. And that often, other objects  
> (such as SystemOrganizers) may be aware of. Short of it is, there are  
> quite a few references that make it long lived.
>
> The copy otoh, becomes aware of its superclass (so it can use all the  
> former methods through inheritence), but the original, has no idea a  
> new "subclass" of it exists. So when no instances are alive with a  
> class pointer referencing this thing, it will be GCed. Also there is  
> no way to get at this class object, unless you can find the instance  
> of it. This is why it is said to be "lightweight".
>
> --
> Travis Griggs
> Objologist
> "Is success the potential of what could be, or the reality of what is?"
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>  

--
Visit <http://tggagne.blogspot.com/> for more great reading.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Steven Kelly
In reply to this post by Martin Rubi-2
I've successfully avoided logging with this hack:
| ix |
ix := SourceFileManager default allFiles indexOf: nil.
SourceFileManager default target: ix while: ["code that you don't want logged"]

Steve

> On 01 December 2008 21:48 Thomas Gagné wrote:
> I know I'm way late on this thread, but when I tried using lightweight
> (anonymous) classes before, one of the annoying things about them was
> their creation was logged in the changes file.  At the rate I wanted to
> create them this would have made for a fairly unruly changes file.  My
> attempts to create the classes without the logging were unsuccessful.
>
> Travis Griggs wrote:
> > On Aug 29, 2008, at 1:11 AM, Stefan Schmiedl wrote:
> >
> >
> >> On Thu, 28 Aug 2008 15:48:30 -0700
> >> Travis Griggs <[hidden email]> wrote:
> >>
> >>
> >>> Rolling your own is pretty easy too. Here's an example:
> >>>
> >>> | list |
> >>> list := OrderedCollection new.
> >>> list add: 42.
> >>> Transcript print: list; cr; endEntry.
> >>> list changeClassTo: (list class copy superclass: list class).
> >>> list class compile: 'add: anObject ^super remove: anObject'.
> >>> list add: 42.
> >>> Transcript print: list; cr; endEntry.
> >>>
> >>> The first 4 lines just create a normal object and output it. The
> next
> >>> line makes it have a lightweight class,  line after that makes it
> so
> >>> that add: turns into remove:. And the last 2 demonstrate that it
> >>> worked.
> >>>
> >>>
> >> What's the weight of a class name?
> >>
> >> IOW, why is the class constructed by
> >>
> >> list class copy superclass: list class
> >>
> >> lightweight with respect to a "normal" class?
> >>
> >> just making smalltalk,
> >>
> >
> > Normally, a class is aware of it's subclasses. And aware of its
> > superclass, thus forming a doubly linked graph. By knowing 'Class
> > rootsOfTheWorld' then, you can find all "first class" classes, by
> > traversing all subclasses. These are classes that you can refer to by
> > name, that can be bound into a method. And that often, other objects
> > (such as SystemOrganizers) may be aware of. Short of it is, there are
> > quite a few references that make it long lived.
> >
> > The copy otoh, becomes aware of its superclass (so it can use all the
> > former methods through inheritence), but the original, has no idea a
> > new "subclass" of it exists. So when no instances are alive with a
> > class pointer referencing this thing, it will be GCed. Also there is
> > no way to get at this class object, unless you can find the instance
> > of it. This is why it is said to be "lightweight".
> >
> > --
> > Travis Griggs
> > Objologist
> > "Is success the potential of what could be, or the reality of what
> is?"
> >
> >
> > _______________________________________________
> > vwnc mailing list
> > [hidden email]
> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
> >
> >
> >
>
> --
> Visit <http://tggagne.blogspot.com/> for more great reading.
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] per instance behaviour in VW ?

Ladislav Lenart
In reply to this post by Thomas Gagné-2
Thomas Gagné wrote:

> I know I'm way late on this thread, but when I tried using lightweight
> (anonymous) classes before, one of the annoying things about them was
> their creation was logged in the changes file.  At the rate I wanted to
> create them this would have made for a fairly unruly changes file.  My
> attempts to create the classes without the logging were unsuccessful.
>
> Anyway, I think it would be an interesting thing to have an
> implementation of anonymous classes without logging--making them about
> as light-weight as you can get.  Very interesting possibilities for
> manipulating data coming from external sources about which little
> (certain) is known.

Well, it depends on what you want to achieve. I implemented simple
prototypes using Behavior. Behavior does not pollute change set but
cannot add instance variables. I used the following scheme:
  * Common superclass named Prototype that has one inst var attributes
    of type Dictionary.
  * Added clone method to insert aBehavior to the inheritance chain.
This way I replaced inst vars with inherited attributes and individual
prototype can have its own methods added to its Behavior instance.

HTH,

Ladislav Lenart


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc