[vwnc] Store extensions

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

[vwnc] Store extensions

Mark Plas

Hello,

 

I have an idea for a possible improvement of Store.

 

Recently I got into a situation where I wanted to add an instance variable to ApplicationStandardSystemController. To do this, I had to override its class definition. Next, I wanted to have a pair of accessors for this variable: no problem, I can just add them in a separate package that is an extension on the class. Then I want to initialize the variable in the #initialize method. Unfortunately initialize is already implemented, so I have to override it like this:

 

initialize

      …existing code…

      self myVariable: …anObject…

 

Next I want to wrap some existing methods in the class with some code that looks like:

 

someExistingMethod

 

      ^self doSomethingNewWhile: […existing code…]

 

Again, I override #someExistingMethod.

 

The bad thing is that each time I override something, I get into trouble when a new version of VW (or some library) arrives. I need to go through all my overrides to see whether they’re still ok, simply because overrides completely replace the existing code with something else without any link whatsoever to the original. If someone adds an instvar the the class I have overridden, then I have to do the override again. The same for changes to the initialize method and #someMethod.

 

Here’s a proposal to overcome this kind of problem: instead of overriding one should be able to extend every kind of programming concept.

 

What does this mean? You should be able to do this:

-        add instvars by means of an extension, NOT by overriding a class definition

-        add class instvars via extensions (shared variables do this already)

-        extend existing methods

o        by appending code

o        by prepending code

o        by wrapping code around them

-        other?

 

My example could then be done as follows:

-        I add a new instvar to ApplicationStandardSystemController without overriding its definition

-        I add the accessing methods in an extension (this already exists)

-        I append a single line of code to the initialize method containing ‘self myVariable: anObject’, without completely overriding the #initialize method

-        I can wrap existing methods with something like:

o        ‘self doSomethingNewWhile: [@overridden_method@]’

o        Here @overridden_method@ is a special place holder that the compiler can replace with the original method.

 

With these constructs you can modify system classes/external library code, without having to worry too much about new versions. It’s a bit like aspect oriented programming or method wrappers. It won’t solve all problems related to modifying third party code, but it would work pretty good in a lot of cases and would certainly work a lot better than what we can do with the existing overrides.

 

Any thoughts on this?

-Mark

 


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

Re: [vwnc] Store extensions

Stefan Schmiedl
On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas <[hidden email]> wrote:

> Any thoughts on this?

What's the advantage over creating a subclass and refering
to the superclass implementation?

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

Re: [vwnc] Store extensions

Dennis smith-4
Well I can see two (in different cases).

Some classes are referred to by name, particularly in
the UI subsystems, so to use a subclass you still have
to go and make a change to at least one other class.

Also, in the case of something like "Object", you cannot
subclass it to get what you want.

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.

Stefan Schmiedl wrote:
On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas [hidden email] wrote:

  
Any thoughts on this?
    

What's the advantage over creating a subclass and refering
to the superclass implementation?

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

-- 
Dennis Smith                 		         +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              <a class="moz-txt-link-freetext" href="sip:dennis@CherniakSoftware.com">sip:dennis@...
Canada			         http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP

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

Re: [vwnc] Store extensions

Mark Plas
In reply to this post by Stefan Schmiedl
Stefan,

If you look at ApplicationStandardSystemController for instance, you'll see that it has many subclasses. I want to change the behavior on ApplicationStandardSystemController so that each subclass can inherit it. You cannot solve this with subclassing.

Mark

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Stefan Schmiedl
Sent: woensdag 19 november 2008 15:40
To: [hidden email]
Subject: Re: [vwnc] Store extensions

On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas <[hidden email]> wrote:

> Any thoughts on this?

What's the advantage over creating a subclass and refering
to the superclass implementation?

s.
_______________________________________________
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] Store extensions

Stevenson, Dave (contr)
In reply to this post by Dennis smith-4
If you were to have several overrides / extensions on the same method, the order would presumably depend on load order. If you then do:
 
    self doThisMethodOverride
 
What you get at runtime could differ significantly from what you expected if the user has loaded other packages that "extend" the same method.

Stevenson, Dave (contr) <[hidden email]>
972-946-4890

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Smith
Sent: Wednesday, November 19, 2008 9:03 AM
To: Stefan Schmiedl
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

Well I can see two (in different cases).

Some classes are referred to by name, particularly in
the UI subsystems, so to use a subclass you still have
to go and make a change to at least one other class.

Also, in the case of something like "Object", you cannot
subclass it to get what you want.

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.

Stefan Schmiedl wrote:
On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas [hidden email] wrote:

  
Any thoughts on this?
    

What's the advantage over creating a subclass and refering
to the superclass implementation?

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

-- 
Dennis Smith                 		         +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              <A class=moz-txt-link-freetext href="sip:dennis@CherniakSoftware.com">sip:dennis@...
Canada			         http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP

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

Re: [vwnc] Store extensions

Mark Plas
In reply to this post by Dennis smith-4

Dennis,

 

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.”

 

Perhaps a pseudo variable ‘overriddenMethod’ can be introduced (like #thisContext) and that responds to #value, #value:, #value:value: etc. Then you can write:

 

myOverriddenMethod: aString

 

      self firstDoSomethingDifferent.

      overriddenMethod value: aString.

      self doSomeOtherThings

 

That sounds interesting.

 

This technique can make the customisation of the development environment easier. For instance, instead of having to override a method to add a single new menu item (and losing menuitems in future updates), you could override it by doing:

 

menu

 

      ^overriddenMethod value addItem: <…item…>

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Smith
Sent: woensdag 19 november 2008 16:03
To: Stefan Schmiedl
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

 

Well I can see two (in different cases).

Some classes are referred to by name, particularly in
the UI subsystems, so to use a subclass you still have
to go and make a change to at least one other class.

Also, in the case of something like "Object", you cannot
subclass it to get what you want.

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.

Stefan Schmiedl wrote:

On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas [hidden email] wrote:
 
  
Any thoughts on this?
    
 
What's the advantage over creating a subclass and refering
to the superclass implementation?
 
s.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
  



-- 
Dennis Smith                                   +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              <a
href="sip:dennis@CherniakSoftware.com">sip:dennis@...
Canada                          http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP

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

Re: [vwnc] Store extensions

Stefan Schmiedl
In reply to this post by Mark Plas
On Wed, 19 Nov 2008 16:07:14 +0100
Mark Plas <[hidden email]> wrote:

> Stefan,
>
> If you look at ApplicationStandardSystemController for instance,
> you'll see that it has many subclasses. I want to change the behavior
> on ApplicationStandardSystemController so that each subclass can
> inherit it. You cannot solve this with subclassing.

Ah, yes. I had not thought of that possibility.

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

Re: [vwnc] Store extensions

Travis Griggs-3
In reply to this post by Mark Plas

On Nov 19, 2008, at 5:34 AM, Mark Plas wrote:

> -        add instvars by means of an extension, NOT by overriding a  
> class definition
> -        add class instvars via extensions (shared variables do this  
> already)

http://www.cincomsmalltalk.com/userblogs/travis/blogView?showComments=true&printTitle=Managing_Instance_Variables_Methodically&entry=3376826809

--
Travis Griggs
Objologist
"The best way to know you have a mind is to change it" -Judge Pierre  
Leval




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

Re: [vwnc] Store extensions

Mark Plas
In reply to this post by Stevenson, Dave (contr)

Hi Dave,

 

I think the same goes for the existing system of overrides. The last loaded package wins, so the order in which you load is important.

 

In another mail there are some thoughts along the lines of a pseudo variable ‘overriddenMethod’. Suppose that this one is a dictionary containing the overriddenmethod for a given compiledmethod, then each method could just call its overriddenmethod.

 

For instance, writing:

 

      overriddenMethod value: aString

 

would secretly do:

 

(overriddenMethodDictionary at: thisContext method) value: aString

 

And each overriddenmethod in the chain would always call its previous one, following the load order.

 

And if the execution order really gets tricky, you should perhaps be able to specify the order of overrides by referring to a packagename. Something like “this method override should come after overrides of ‘My-Package’” or “this method override should always come last”.

 

Mark

     

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Stevenson, Dave (contr)
Sent: woensdag 19 november 2008 16:17
To: [hidden email]
Subject: Re: [vwnc] Store extensions

 

If you were to have several overrides / extensions on the same method, the order would presumably depend on load order. If you then do:

 

    self doThisMethodOverride

 

What you get at runtime could differ significantly from what you expected if the user has loaded other packages that "extend" the same method.

 

Stevenson, Dave (contr) <[hidden email]>
972-946-4890

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Smith
Sent: Wednesday, November 19, 2008 9:03 AM
To: Stefan Schmiedl
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

Well I can see two (in different cases).

Some classes are referred to by name, particularly in
the UI subsystems, so to use a subclass you still have
to go and make a change to at least one other class.

Also, in the case of something like "Object", you cannot
subclass it to get what you want.

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.

Stefan Schmiedl wrote:

On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas [hidden email] wrote:
 
  
Any thoughts on this?
    
 
What's the advantage over creating a subclass and refering
to the superclass implementation?
 
s.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
  



-- 
Dennis Smith                                   +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              <a
href="sip:dennis@CherniakSoftware.com">sip:dennis@...
Canada                          http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP

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

Re: [vwnc] Store extensions

Paul Baumann
In reply to this post by Mark Plas
The pseudo variable approach is interesting, but my experience is that it is easy to transiently exchange methods.
 
I implemented method override support for both VA and VW before it became a feature of VW. The way I did it preserves the original overridden method and allows it to be seen and executed. Overrides were explicitly declared rather than accidental.
 
Application code declares a new method named #override_myMethod to override a method named #myMethod. The framework recognizes the pattern #override_* and knows to rename a method equal to the the suffex (#myMethod) to #overridden_myMethod. The framework also transiently exchanges #myMethod in the method dictionary with #override_myMethod.
 
The overridden behavior can be explicitly called from within the override method. It worked well and changes were maintained properly through loads and such. Alas, the code is only available for ENVY-based images. I sure miss being able to execute overridden code with the current VW override support. Without the ability to refer to overridden code then you need to copy (and maintain) code that may change by others in the their next release.
 
The code is available as Public Domain here:
 
 
Paul Baumann 
 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Mark Plas
Sent: Wednesday, November 19, 2008 10:44 AM
To: Dennis Smith
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

Dennis,

 

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.”

 

Perhaps a pseudo variable ‘overriddenMethod’ can be introduced (like #thisContext) and that responds to #value, #value:, #value:value: etc. Then you can write:

 

myOverriddenMethod: aString

 

      self firstDoSomethingDifferent.

      overriddenMethod value: aString.

      self doSomeOtherThings

 

That sounds interesting.

 

This technique can make the customisation of the development environment easier. For instance, instead of having to override a method to add a single new menu item (and losing menuitems in future updates), you could override it by doing:

 

menu

 

      ^overriddenMethod value addItem: <…item…>

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Smith
Sent: woensdag 19 november 2008 16:03
To: Stefan Schmiedl
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

 

Well I can see two (in different cases).

Some classes are referred to by name, particularly in
the UI subsystems, so to use a subclass you still have
to go and make a change to at least one other class.

Also, in the case of something like "Object", you cannot
subclass it to get what you want.

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.

Stefan Schmiedl wrote:

On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas [hidden email] wrote:
 
  
Any thoughts on this?
    
 
What's the advantage over creating a subclass and refering
to the superclass implementation?
 
s.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
  



-- 
Dennis Smith                                   +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              <a href="sip:dennis@CherniakSoftware.com">sip:dennis@...
Canada                          http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

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

Re: [vwnc] Store extensions

Terry Raymond

Paul

 

And what happens if the overridden method refers to a renamed

instance variable?

 

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 Paul Baumann
Sent: Wednesday, November 19, 2008 1:35 PM
To: 'Mark Plas'; Dennis Smith
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

 

The pseudo variable approach is interesting, but my experience is that it is easy to transiently exchange methods.

 

I implemented method override support for both VA and VW before it became a feature of VW. The way I did it preserves the original overridden method and allows it to be seen and executed. Overrides were explicitly declared rather than accidental.

 

Application code declares a new method named #override_myMethod to override a method named #myMethod. The framework recognizes the pattern #override_* and knows to rename a method equal to the the suffex (#myMethod) to #overridden_myMethod. The framework also transiently exchanges #myMethod in the method dictionary with #override_myMethod.

 

The overridden behavior can be explicitly called from within the override method. It worked well and changes were maintained properly through loads and such. Alas, the code is only available for ENVY-based images. I sure miss being able to execute overridden code with the current VW override support. Without the ability to refer to overridden code then you need to copy (and maintain) code that may change by others in the their next release.

 

The code is available as Public Domain here:

 

http://sourceforge.net/projects/methodoverride/

 

Paul Baumann 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Mark Plas
Sent: Wednesday, November 19, 2008 10:44 AM
To: Dennis Smith
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

Dennis,

 

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.”

 

Perhaps a pseudo variable ‘overriddenMethod’ can be introduced (like #thisContext) and that responds to #value, #value:, #value:value: etc. Then you can write:

 

myOverriddenMethod: aString

 

      self firstDoSomethingDifferent.

      overriddenMethod value: aString.

      self doSomeOtherThings

 

That sounds interesting.

 

This technique can make the customisation of the development environment easier. For instance, instead of having to override a method to add a single new menu item (and losing menuitems in future updates), you could override it by doing:

 

menu

 

      ^overriddenMethod value addItem: <…item…>

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Smith
Sent: woensdag 19 november 2008 16:03
To: Stefan Schmiedl
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

 

Well I can see two (in different cases).

Some classes are referred to by name, particularly in
the UI subsystems, so to use a subclass you still have
to go and make a change to at least one other class.

Also, in the case of something like "Object", you cannot
subclass it to get what you want.

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.

Stefan Schmiedl wrote:

On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas [hidden email] wrote:
 
  
Any thoughts on this?
    
 
What's the advantage over creating a subclass and refering
to the superclass implementation?
 
s.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
  

 

-- 
Dennis Smith                                   +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              <a
href="sip:dennis@CherniakSoftware.com">sip:dennis@...
Canada                          http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


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

Re: [vwnc] Store extensions

Michel Tilman
In reply to this post by Mark Plas
Hello Mark,

For the method part I did a few short experiments a couple of years ago, using method wrappers (of course this induces a performance penalty): 


Regards,

michel


On 19 Nov 2008, at 14:34, Mark Plas wrote:

Hello,
 
I have an idea for a possible improvement of Store.
 
Recently I got into a situation where I wanted to add an instance variable to ApplicationStandardSystemController. To do this, I had to override its class definition. Next, I wanted to have a pair of accessors for this variable: no problem, I can just add them in a separate package that is an extension on the class. Then I want to initialize the variable in the #initialize method. Unfortunately initialize is already implemented, so I have to override it like this:
 
initialize
      …existing code…
      self myVariable: …anObject…
 
Next I want to wrap some existing methods in the class with some code that looks like:
 
someExistingMethod
 
      ^self doSomethingNewWhile: […existing code…]
 
Again, I override #someExistingMethod.
 
The bad thing is that each time I override something, I get into trouble when a new version of VW (or some library) arrives. I need to go through all my overrides to see whether they’re still ok, simply because overrides completely replace the existing code with something else without any link whatsoever to the original. If someone adds an instvar the the class I have overridden, then I have to do the override again. The same for changes to the initialize method and #someMethod.
 
Here’s a proposal to overcome this kind of problem: instead of overriding one should be able to extend every kind of programming concept.
 
What does this mean? You should be able to do this:
-        add instvars by means of an extension, NOT by overriding a class definition
-        add class instvars via extensions (shared variables do this already)
-        extend existing methods
o        by appending code
o        by prepending code
o        by wrapping code around them
-        other?
 
My example could then be done as follows:
-        I add a new instvar to ApplicationStandardSystemController without overriding its definition
-        I add the accessing methods in an extension (this already exists)
-        I append a single line of code to the initialize method containing ‘self myVariable: anObject’, without completely overriding the #initialize method
-        I can wrap existing methods with something like:
o        â€˜self doSomethingNewWhile: [@overridden_method@]’
o        Here @overridden_method@ is a special place holder that the compiler can replace with the original method.
 
With these constructs you can modify system classes/external library code, without having to worry too much about new versions. It’s a bit like aspect oriented programming or method wrappers. It won’t solve all problems related to modifying third party code, but it would work pretty good in a lot of cases and would certainly work a lot better than what we can do with the existing overrides.
 
Any thoughts on this?
-Mark
 
_______________________________________________
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] Store extensions

Michel Tilman
In reply to this post by Travis Griggs-3
Hello,

One of the questions with this approach is how much freedom you are going to give to the user. Are e.g. the following allowed:

someOfMyInstanceVariables
    <slotNames> 
^... ifTrue: [] ifFalse: []

or:

someOfMyInstanceVariables
    <slotNames> 
| a |

a add: ...
... ifTrue: [ a add: ... ]
...
a add: ...
^ a

How will all this affect, for instance, refactoring tools?

Regards,

michel


On 19 Nov 2008, at 16:54, Travis Griggs wrote:


On Nov 19, 2008, at 5:34 AM, Mark Plas wrote:

-        add instvars by means of an extension, NOT by overriding a  
class definition
-        add class instvars via extensions (shared variables do this  
already)

http://www.cincomsmalltalk.com/userblogs/travis/blogView?showComments=true&printTitle=Managing_Instance_Variables_Methodically&entry=3376826809

--
Travis Griggs
Objologist
"The best way to know you have a mind is to change it" -Judge Pierre  
Leval




_______________________________________________
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] Store extensions

Mark Plas
In reply to this post by Paul Baumann

Hi Paul,

 

I don’t have VA. Would it be possible to email a fileout of the code?

 

And does your technique handle multiple overrides of the same method?

 

Thanks,

Mark

 


From: Paul Baumann [mailto:[hidden email]]
Sent: woensdag 19 november 2008 19:35
To: Mark Plas; Dennis Smith
Cc: [hidden email]
Subject: RE: [vwnc] Store extensions

 

The pseudo variable approach is interesting, but my experience is that it is easy to transiently exchange methods.

 

I implemented method override support for both VA and VW before it became a feature of VW. The way I did it preserves the original overridden method and allows it to be seen and executed. Overrides were explicitly declared rather than accidental.

 

Application code declares a new method named #override_myMethod to override a method named #myMethod. The framework recognizes the pattern #override_* and knows to rename a method equal to the the suffex (#myMethod) to #overridden_myMethod. The framework also transiently exchanges #myMethod in the method dictionary with #override_myMethod.

 

The overridden behavior can be explicitly called from within the override method. It worked well and changes were maintained properly through loads and such. Alas, the code is only available for ENVY-based images. I sure miss being able to execute overridden code with the current VW override support. Without the ability to refer to overridden code then you need to copy (and maintain) code that may change by others in the their next release.

 

The code is available as Public Domain here:

 

http://sourceforge.net/projects/methodoverride/

 

Paul Baumann 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Mark Plas
Sent: Wednesday, November 19, 2008 10:44 AM
To: Dennis Smith
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

Dennis,

 

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.”

 

Perhaps a pseudo variable ‘overriddenMethod’ can be introduced (like #thisContext) and that responds to #value, #value:, #value:value: etc. Then you can write:

 

myOverriddenMethod: aString

 

      self firstDoSomethingDifferent.

      overriddenMethod value: aString.

      self doSomeOtherThings

 

That sounds interesting.

 

This technique can make the customisation of the development environment easier. For instance, instead of having to override a method to add a single new menu item (and losing menuitems in future updates), you could override it by doing:

 

menu

 

      ^overriddenMethod value addItem: <…item…>

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Smith
Sent: woensdag 19 november 2008 16:03
To: Stefan Schmiedl
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

 

Well I can see two (in different cases).

Some classes are referred to by name, particularly in
the UI subsystems, so to use a subclass you still have
to go and make a change to at least one other class.

Also, in the case of something like "Object", you cannot
subclass it to get what you want.

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.

Stefan Schmiedl wrote:

On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas [hidden email] wrote:
 
  
Any thoughts on this?
    
 
What's the advantage over creating a subclass and refering
to the superclass implementation?
 
s.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
  

 

-- 
Dennis Smith                                   +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              <a
href="sip:dennis@CherniakSoftware.com">sip:dennis@...
Canada                          http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


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

Re: [vwnc] Store extensions

Mark Plas
In reply to this post by Michel Tilman

Hello Michel,

 

Is some of this code available in public?

 

Thanks,

Mark

 


From: Michel Tilman [mailto:[hidden email]]
Sent: woensdag 19 november 2008 20:44
To: Mark Plas
Cc: vwnc NC
Subject: Re: [vwnc] Store extensions

 

Hello Mark,

 

For the method part I did a few short experiments a couple of years ago, using method wrappers (of course this induces a performance penalty): 

 

 

Regards,

 

michel

 

 

On 19 Nov 2008, at 14:34, Mark Plas wrote:



Hello,

 

I have an idea for a possible improvement of Store.

 

Recently I got into a situation where I wanted to add an instance variable to ApplicationStandardSystemController. To do this, I had to override its class definition. Next, I wanted to have a pair of accessors for this variable: no problem, I can just add them in a separate package that is an extension on the class. Then I want to initialize the variable in the #initialize method. Unfortunately initialize is already implemented, so I have to override it like this:

 

initialize

      …existing code…

      self myVariable: …anObject…

 

Next I want to wrap some existing methods in the class with some code that looks like:

 

someExistingMethod

 

      ^self doSomethingNewWhile: […existing code…]

 

Again, I override #someExistingMethod.

 

The bad thing is that each time I override something, I get into trouble when a new version of VW (or some library) arrives. I need to go through all my overrides to see whether they’re still ok, simply because overrides completely replace the existing code with something else without any link whatsoever to the original. If someone adds an instvar the the class I have overridden, then I have to do the override again. The same for changes to the initialize method and #someMethod.

 

Here’s a proposal to overcome this kind of problem: instead of overriding one should be able to extend every kind of programming concept.

 

What does this mean? You should be able to do this:

-        add instvars by means of an extension, NOT by overriding a class definition

-        add class instvars via extensions (shared variables do this already)

-        extend existing methods

o        by appending code

o        by prepending code

o        by wrapping code around them

-        other?

 

My example could then be done as follows:

-        I add a new instvar to ApplicationStandardSystemController without overriding its definition

-        I add the accessing methods in an extension (this already exists)

-        I append a single line of code to the initialize method containing ‘self myVariable: anObject’, without completely overriding the #initialize method

-        I can wrap existing methods with something like:

o        ‘self doSomethingNewWhile: [@overridden_method@]’

o        Here @overridden_method@ is a special place holder that the compiler can replace with the original method.

 

With these constructs you can modify system classes/external library code, without having to worry too much about new versions. It’s a bit like aspect oriented programming or method wrappers. It won’t solve all problems related to modifying third party code, but it would work pretty good in a lot of cases and would certainly work a lot better than what we can do with the existing overrides.

 

Any thoughts on this?

-Mark

 

_______________________________________________
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] Store extensions

Mark Plas
In reply to this post by Travis Griggs-3
Hi Travis,

I loaded the NamedSlots, preload & testbundle. Then I made a new class and implemented

        <slotNames>
        ^#('x' 'y' 'z')

Then I implemented accessors for these variables and they compile fine. But when I create an instance, it doesn't have any variables. And when I call one of the accessing method, VW crashes and the image just disappears.

What am I doing wrong?
Thanks,
Mark

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Travis Griggs
Sent: woensdag 19 november 2008 16:55
To: vwnc NC
Subject: Re: [vwnc] Store extensions


On Nov 19, 2008, at 5:34 AM, Mark Plas wrote:

> -        add instvars by means of an extension, NOT by overriding a
> class definition
> -        add class instvars via extensions (shared variables do this
> already)

http://www.cincomsmalltalk.com/userblogs/travis/blogView?showComments=true&printTitle=Managing_Instance_Variables_Methodically&entry=3376826809

--
Travis Griggs
Objologist
"The best way to know you have a mind is to change it" -Judge Pierre
Leval




_______________________________________________
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] Store extensions

Paul Baumann
In reply to this post by Mark Plas
>>I don’t have VA. Would it be possible to email a fileout of the code?
 
I don't have an ENVY envirionment handy either. It be possible to load the code into VA, file out the common parts, and then copy-paste from the unloaded visualworks-specific subapplications. It isn't something I have time to work on right now--perhaps this evening though.
 
There may be a core of code that can be ported and has value, but the code related to event detection (like method changes) would likely be obsolete now. I think the framework was only a couple dozen methods. It might even be simpler without the ENVY-specific code. The trickiest part of the ENVY implementation was in making sure that ENVY showed and maintained the correct methods when any of the three types of methods are changed or loaded (normal, override, and overridden).
 
>>And does your technique handle multiple overrides of the same method?
 
Pre-Store images handled method collisions by reporting a problem and one would win (I think the load failed atomically and the original won). Store-enabled images don't report a problem and load the collision as an override. In a Store image, if two frameworks both implemented an #override_ prefixed method then the last loaded should win just like any other collision. Package post-load code would sweep the image to fixup overrides.
 
Paul Baumann 
 


From: Mark Plas [mailto:[hidden email]]
Sent: Thursday, November 20, 2008 7:52 AM
To: Paul Baumann
Cc: [hidden email]
Subject: RE: [vwnc] Store extensions
Importance: High

Hi Paul,

 

I don’t have VA. Would it be possible to email a fileout of the code?

 

And does your technique handle multiple overrides of the same method?

 

Thanks,

Mark

 


From: Paul Baumann [mailto:[hidden email]]
Sent: woensdag 19 november 2008 19:35
To: Mark Plas; Dennis Smith
Cc: [hidden email]
Subject: RE: [vwnc] Store extensions

 

The pseudo variable approach is interesting, but my experience is that it is easy to transiently exchange methods.

 

I implemented method override support for both VA and VW before it became a feature of VW. The way I did it preserves the original overridden method and allows it to be seen and executed. Overrides were explicitly declared rather than accidental.

 

Application code declares a new method named #override_myMethod to override a method named #myMethod. The framework recognizes the pattern #override_* and knows to rename a method equal to the the suffex (#myMethod) to #overridden_myMethod. The framework also transiently exchanges #myMethod in the method dictionary with #override_myMethod.

 

The overridden behavior can be explicitly called from within the override method. It worked well and changes were maintained properly through loads and such. Alas, the code is only available for ENVY-based images. I sure miss being able to execute overridden code with the current VW override support. Without the ability to refer to overridden code then you need to copy (and maintain) code that may change by others in the their next release.

 

The code is available as Public Domain here:

 

http://sourceforge.net/projects/methodoverride/

 

Paul Baumann 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Mark Plas
Sent: Wednesday, November 19, 2008 10:44 AM
To: Dennis Smith
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

Dennis,

 

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.”

 

Perhaps a pseudo variable ‘overriddenMethod’ can be introduced (like #thisContext) and that responds to #value, #value:, #value:value: etc. Then you can write:

 

myOverriddenMethod: aString

 

      self firstDoSomethingDifferent.

      overriddenMethod value: aString.

      self doSomeOtherThings

 

That sounds interesting.

 

This technique can make the customisation of the development environment easier. For instance, instead of having to override a method to add a single new menu item (and losing menuitems in future updates), you could override it by doing:

 

menu

 

      ^overriddenMethod value addItem: <…item…>

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Smith
Sent: woensdag 19 november 2008 16:03
To: Stefan Schmiedl
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

 

Well I can see two (in different cases).

Some classes are referred to by name, particularly in
the UI subsystems, so to use a subclass you still have
to go and make a change to at least one other class.

Also, in the case of something like "Object", you cannot
subclass it to get what you want.

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.

Stefan Schmiedl wrote:

On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas [hidden email] wrote:
 
  
Any thoughts on this?
    
 
What's the advantage over creating a subclass and refering
to the superclass implementation?
 
s.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
  

 

-- 
Dennis Smith                                   +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              <a href="sip:dennis@CherniakSoftware.com">sip:dennis@...
Canada                          http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.



This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

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

Re: [vwnc] Store extensions

Paul Baumann
In reply to this post by Terry Raymond
Terry,
 
The overridden method is part of the same framework that defines the renamed inst var. It would not be inconsistent. That scenario would not happen.
 
Perhaps you meant to ask about an #override_ method referring to a renamed variable. In that case, the #override_method is rebound just like any other method. If the #override_ method refers to a variable that no longer exists then VW would notify you of a compile error at load time.
 
Here is an example of how declaring #override_ methods that reference #overridden_ methods would avoid the schema change issues:
 
    Original:
        schema: (name address)
        name
            ^name
    Original after override loaded:
        name    (copy of #override_name)
            ^self title, ' ', self overridden_name
        overridden_name  (the original #name)
            ^name
        override_name
            ^self title, ' ', self overridden_name
 
    New
        schema: (nombre address)
        name
            ^nombre
    New after override loaded:
        name    (copy of #override_name)
            ^self title, ' ', self overridden_name
        overridden_name  (the original #name)
            ^nombre
        override_name
            ^self title, ' ', self overridden_name
 
Note that if #name does not exist in the New version then the best thing to do would be to copy #override_name to #name anyway. Execution would correctly error with MNU #overridden_name if #name were sent.
 
Paul Baumann 
 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Terry Raymond
Sent: Wednesday, November 19, 2008 2:23 PM
To: [hidden email]
Subject: Re: [vwnc] Store extensions

Paul

 

And what happens if the overridden method refers to a renamed

instance variable?

 

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 Paul Baumann
Sent: Wednesday, November 19, 2008 1:35 PM
To: 'Mark Plas'; Dennis Smith
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

 

The pseudo variable approach is interesting, but my experience is that it is easy to transiently exchange methods.

 

I implemented method override support for both VA and VW before it became a feature of VW. The way I did it preserves the original overridden method and allows it to be seen and executed. Overrides were explicitly declared rather than accidental.

 

Application code declares a new method named #override_myMethod to override a method named #myMethod. The framework recognizes the pattern #override_* and knows to rename a method equal to the the suffex (#myMethod) to #overridden_myMethod. The framework also transiently exchanges #myMethod in the method dictionary with #override_myMethod.

 

The overridden behavior can be explicitly called from within the override method. It worked well and changes were maintained properly through loads and such. Alas, the code is only available for ENVY-based images. I sure miss being able to execute overridden code with the current VW override support. Without the ability to refer to overridden code then you need to copy (and maintain) code that may change by others in the their next release.

 

The code is available as Public Domain here:

 

http://sourceforge.net/projects/methodoverride/

 

Paul Baumann 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Mark Plas
Sent: Wednesday, November 19, 2008 10:44 AM
To: Dennis Smith
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

Dennis,

 

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.”

 

Perhaps a pseudo variable ‘overriddenMethod’ can be introduced (like #thisContext) and that responds to #value, #value:, #value:value: etc. Then you can write:

 

myOverriddenMethod: aString

 

      self firstDoSomethingDifferent.

      overriddenMethod value: aString.

      self doSomeOtherThings

 

That sounds interesting.

 

This technique can make the customisation of the development environment easier. For instance, instead of having to override a method to add a single new menu item (and losing menuitems in future updates), you could override it by doing:

 

menu

 

      ^overriddenMethod value addItem: <…item…>

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Smith
Sent: woensdag 19 november 2008 16:03
To: Stefan Schmiedl
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

 

Well I can see two (in different cases).

Some classes are referred to by name, particularly in
the UI subsystems, so to use a subclass you still have
to go and make a change to at least one other class.

Also, in the case of something like "Object", you cannot
subclass it to get what you want.

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.

Stefan Schmiedl wrote:

On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas [hidden email] wrote:
 
  
Any thoughts on this?
    
 
What's the advantage over creating a subclass and refering
to the superclass implementation?
 
s.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
  

 

-- 
Dennis Smith                                   +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              <a href="sip:dennis@CherniakSoftware.com">sip:dennis@...
Canada                          http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.



This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

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

Re: [vwnc] Store extensions

Travis Griggs-3
In reply to this post by Mark Plas
On Nov 20, 2008, at 5:12 AM, Mark Plas wrote:

> Hi Travis,
>
> I loaded the NamedSlots, preload & testbundle. Then I made a new  
> class and implemented
>
>        <slotNames>
>        ^#('x' 'y' 'z')
>
> Then I implemented accessors for these variables and they compile  
> fine. But when I create an instance, it doesn't have any variables.  
> And when I call one of the accessing method, VW crashes and the  
> image just disappears.

I don't know. I'll have to play with it. I should caveat said blog and  
associated code by noting that it was quite prototypical. I'll see if  
I can't make some play time to check the current status of the stuff.

--
Travis Griggs
Objologist
Light travels faster than sound. This is why some people appear bright  
until you hear them speak...




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

Re: [vwnc] Store extensions

Terry Raymond
In reply to this post by Paul Baumann

Paul

 

The problem is that if you modify the overriden method so it refers to

the renamed ivar then you have also modified the source. Now its

source is not the original source. When someone wants to view the

overriden method source what will they see? How would it compare

to its published version?

 

Terry

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


From: Paul Baumann [mailto:[hidden email]]
Sent: Thursday, November 20, 2008 10:03 AM
To: 'Terry Raymond'; [hidden email]
Subject: RE: [vwnc] Store extensions

 

Terry,

 

The overridden method is part of the same framework that defines the renamed inst var. It would not be inconsistent. That scenario would not happen.

 

Perhaps you meant to ask about an #override_ method referring to a renamed variable. In that case, the #override_method is rebound just like any other method. If the #override_ method refers to a variable that no longer exists then VW would notify you of a compile error at load time.

 

Here is an example of how declaring #override_ methods that reference #overridden_ methods would avoid the schema change issues:

 

    Original:

        schema: (name address)

        name

            ^name

    Original after override loaded:

        name    (copy of #override_name)

            ^self title, ' ', self overridden_name

        overridden_name  (the original #name)

            ^name

        override_name

            ^self title, ' ', self overridden_name

 

    New

        schema: (nombre address)

        name

            ^nombre

    New after override loaded:

        name    (copy of #override_name)

            ^self title, ' ', self overridden_name

        overridden_name  (the original #name)

            ^nombre

        override_name

            ^self title, ' ', self overridden_name

 

Note that if #name does not exist in the New version then the best thing to do would be to copy #override_name to #name anyway. Execution would correctly error with MNU #overridden_name if #name were sent.

 

Paul Baumann 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Terry Raymond
Sent: Wednesday, November 19, 2008 2:23 PM
To: [hidden email]
Subject: Re: [vwnc] Store extensions

Paul

 

And what happens if the overridden method refers to a renamed

instance variable?

 

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 Paul Baumann
Sent: Wednesday, November 19, 2008 1:35 PM
To: 'Mark Plas'; Dennis Smith
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

 

The pseudo variable approach is interesting, but my experience is that it is easy to transiently exchange methods.

 

I implemented method override support for both VA and VW before it became a feature of VW. The way I did it preserves the original overridden method and allows it to be seen and executed. Overrides were explicitly declared rather than accidental.

 

Application code declares a new method named #override_myMethod to override a method named #myMethod. The framework recognizes the pattern #override_* and knows to rename a method equal to the the suffex (#myMethod) to #overridden_myMethod. The framework also transiently exchanges #myMethod in the method dictionary with #override_myMethod.

 

The overridden behavior can be explicitly called from within the override method. It worked well and changes were maintained properly through loads and such. Alas, the code is only available for ENVY-based images. I sure miss being able to execute overridden code with the current VW override support. Without the ability to refer to overridden code then you need to copy (and maintain) code that may change by others in the their next release.

 

The code is available as Public Domain here:

 

http://sourceforge.net/projects/methodoverride/

 

Paul Baumann 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Mark Plas
Sent: Wednesday, November 19, 2008 10:44 AM
To: Dennis Smith
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

Dennis,

 

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.”

 

Perhaps a pseudo variable ‘overriddenMethod’ can be introduced (like #thisContext) and that responds to #value, #value:, #value:value: etc. Then you can write:

 

myOverriddenMethod: aString

 

      self firstDoSomethingDifferent.

      overriddenMethod value: aString.

      self doSomeOtherThings

 

That sounds interesting.

 

This technique can make the customisation of the development environment easier. For instance, instead of having to override a method to add a single new menu item (and losing menuitems in future updates), you could override it by doing:

 

menu

 

      ^overriddenMethod value addItem: <…item…>

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Smith
Sent: woensdag 19 november 2008 16:03
To: Stefan Schmiedl
Cc: [hidden email]
Subject: Re: [vwnc] Store extensions

 

Well I can see two (in different cases).

Some classes are referred to by name, particularly in
the UI subsystems, so to use a subclass you still have
to go and make a change to at least one other class.

Also, in the case of something like "Object", you cannot
subclass it to get what you want.

On the note of extending methods, one could do that
by making the overridden method available to be invoked
by the new method.

Stefan Schmiedl wrote:

On Wed, 19 Nov 2008 14:34:02 +0100
Mark Plas [hidden email] wrote:
 
  
Any thoughts on this?
    
 
What's the advantage over creating a subclass and refering
to the superclass implementation?
 
s.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
  

 

-- 
Dennis Smith                                   +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              <a
href="sip:dennis@CherniakSoftware.com">sip:dennis@...
Canada                          http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


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