Fwd: Creating services

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

Fwd: Creating services

stéphane ducasse-2
Romain was checking services and apparently we have to take into  
account a change between 6706 and 6713


> While checking this procedure, I actually found that there is a  
> difference of behavior between version 6706 and version 6713
> of squeak preventing this to work: Object>>#perform:orSendTo: has  
> been modified between the two version.
>
> The bottomline is that the following method should be added:
>
> ServiceAction >> perform: selector orSendTo: otherTarget
> ^ self perform: selector
>
>
> Stef, could you put that in the update stream?
>
> Diego, feel free to ask further question if you need to.
>
> Romain

Reply | Threaded
Open this post in threaded view
|

Re: Creating services

Marcus Denker
Hi,

I don't think that this has been changed.

perform: selector orSendTo: otherTarget
        "If I wish to intercept and handle selector myself, do it; else send  
it to otherTarget"
        ^ otherTarget perform: selector

sw 10/30/1998

But we had already multiple people requesting this to be changed in a  
way that it
does what the selector says:

http://bugs.impara.de/view.php?id=1666

perform: selector orSendTo: otherTarget
        "If I wish to intercept and handle selector myself, do it; else send  
it to otherTarget"
        ^ (self respondsTo: selector) ifTrue: [self perform: selector]  
ifFalse: [otherTarget perform: selector]! !

The only pronlem was that, hehe, the wrong code was there by design,  
this bug report was done multiple
times the past and allways rejecte by SqC.

I tend to just implement the method that it does what it says and see  
what will break.

       Marcus


On 22.01.2006, at 13:24, stéphane ducasse wrote:

> Romain was checking services and apparently we have to take into  
> account a change between 6706 and 6713
>
>
>> While checking this procedure, I actually found that there is a  
>> difference of behavior between version 6706 and version 6713
>> of squeak preventing this to work: Object>>#perform:orSendTo: has  
>> been modified between the two version.
>>
>> The bottomline is that the following method should be added:
>>
>> ServiceAction >> perform: selector orSendTo: otherTarget
>> ^ self perform: selector
>>
>>
>> Stef, could you put that in the update stream?
>>
>> Diego, feel free to ask further question if you need to.
>>
>> Romain
>

Reply | Threaded
Open this post in threaded view
|

Re: Creating services

stéphane ducasse-2
but romain does not ask to changed in Object but in its class  
ServiceAction.
>>> ServiceAction >> perform: selector orSendTo: otherTarget
>>> ^ self perform: selector

Romain?


On 22 janv. 06, at 13:35, Marcus Denker wrote:

> Hi,
>
> I don't think that this has been changed.
>
> perform: selector orSendTo: otherTarget
> "If I wish to intercept and handle selector myself, do it; else  
> send it to otherTarget"
> ^ otherTarget perform: selector
>
> sw 10/30/1998
>
> But we had already multiple people requesting this to be changed in  
> a way that it
> does what the selector says:
>
> http://bugs.impara.de/view.php?id=1666
>
> perform: selector orSendTo: otherTarget
> "If I wish to intercept and handle selector myself, do it; else  
> send it to otherTarget"
> ^ (self respondsTo: selector) ifTrue: [self perform: selector]  
> ifFalse: [otherTarget perform: selector]! !
>
> The only pronlem was that, hehe, the wrong code was there by  
> design, this bug report was done multiple
> times the past and allways rejecte by SqC.
>
> I tend to just implement the method that it does what it says and  
> see what will break.
>
>       Marcus
>
>
> On 22.01.2006, at 13:24, stéphane ducasse wrote:
>
>> Romain was checking services and apparently we have to take into  
>> account a change between 6706 and 6713
>>
>>
>>> While checking this procedure, I actually found that there is a  
>>> difference of behavior between version 6706 and version 6713
>>> of squeak preventing this to work: Object>>#perform:orSendTo:  
>>> has been modified between the two version.
>>>
>>> The bottomline is that the following method should be added:
>>>
>>> ServiceAction >> perform: selector orSendTo: otherTarget
>>> ^ self perform: selector
>>>
>>>
>>> Stef, could you put that in the update stream?
>>>
>>> Diego, feel free to ask further question if you need to.
>>>
>>> Romain
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Creating services

Marcus Denker

On 22.01.2006, at 18:04, Romain Robbes wrote:

>
> Well that would solve my immediate problem without impacting  
> other's people code.
> But then, the fix to object would probably have the same effect, so  
> the choice is up to you.
>

ok, it's in the current build script. new release will be out tommorrow.

     Marcus
Reply | Threaded
Open this post in threaded view
|

Re: Creating services

stéphane ducasse-2
In reply to this post by stéphane ducasse-2
We are sorry for the inconvenience. Welcome to alpha world.
But this is important that we get this kind of feedback.
Thanks.

Stef

On 24 janv. 06, at 04:24, Diego Fernandez wrote:

> Hi Steph, Romain,
> I have loaded the latest Squeak image -6718, hey you are working  
> hard! each time that I check the list there are 2 new versions :).

Indeed in this moment we try to arrive in beta, ie no more new big  
items introduced.

> In my previous image version (6716) I have loaded 'Services-all'  
> and dependencies (and made a couple of patches to make it work), I  
> know that this in development... and maybe that's why I get so  
> frustrated in dealing with those arrays of symbols :P.
>
> This version is much more polished :)
>
> I cannot found "Create new service" option, so I create the new  
> service evaluating:
> BrowserProvider newServiceFor: 'AutomaticMethodCategorizer-Services'
>
> Then I have created the following methods:
>
> AutomaticMethodCategorizerServicesServiceProvider>>browserMethodCatego
> ryMenuItems {saved preferences}
>     ^ #(#'Items in browserMethodCategoryMenu:' #autocategorize 1 )
>
> AutomaticMethodCategorizerServicesServiceProvider>>autocategorize  
> {services}
>     ^ServiceAction
>         text: 'SERVICE TEST'
>         button: 'SERVICE TEST'
>         description: 'first service' action: [Transcript cr; show:  
> 'It worked :)'].
>
> And do a "Rebuild service registry"
>
> But I can't see the options in the menu. I know that I'm missing  
> something
> Thanks in advance for the help!
>
> An small comment about "saved preferences", if its possible avoid  
> the use of those arrays of symbols, they makes the code more  
> difficult to understand (and refactor). For example if the saved  
> preference is refied you could do something like this:
>
> AutomaticMethodCategorizerServicesServiceProvider>>browserMethodCatego
> ryMenuItems {saved preferences}
>     ^SavedServicePreference named: 'Items in  
> browserMethodCategoryMenu:'
>             service: self autocategorize
>             priority: 1
>
> An then #replayPreferences becomes very simple, for example:
> replayPreferences
>     self savedPreferences applyTo: ServicePreferences
>
> SavedServicePreferences>>applyTo: aServicePreferences
>     preferences do: [:each | each applyTo: aServicePreferences ]
>
> SavedServicePreference>>applyTo: aServicePreferences
>     aServicePreferences setPreference: self name toValue: self value
>
> (the order of the preferences could be responsibility of  
> "SavedServicePreferences"... mmm the name that I choose in the  
> example "Saved.." is not a good one)
>
> Thanks for the patience
> Diego.-
>
>
> On 1/22/06, stéphane ducasse <[hidden email]> wrote: romain
>
> it would be good if you can also describe in class comment how to
> define services programmatically.
>
>
> On 22 janv. 06, at 12:33, Romain Robbes wrote:
>
> >       Hi Diego,
> >
> >       The latest version of services (which is in 3.9) functions  
> a bit
> > differently. I tried to simplify the process as much as I could.
> >
> >       You first have to open a browser and select a method in your
> > package. Then you should pop up the method menu in the
> >       browser, and select the 'Create new service' item. This  
> tells the
> > framework to find the service provider class for your package
> >       (creating it if there isn't any), and then asks you for the
> > identifier of the service, which will also be the name of the method
> >       in which it is implemented. Then it will compile an initial
> > version of the service-producing method, that you can fill with
> >       the description of your item and the actual action it  
> should perform.
> >
> >       To plug it in the browser, you should open the services  
> browser
> > (which is located in the world menu).
> >       There you should find the category of items in which you  
> want to
> > put your service in (browserMethodMenu,
> >       browserClassCategoryMenu, if you want to have it in the  
> browser).
> > You just have to insert the identifier of the service
> >       you created in the space-separated list of names you will  
> find here.
> >
> >       If you want to create several services, you may want to  
> create a
> > submenu of all of them. To do this, create a ServiceCategory
> >       object in your service provider (it is the same procedure  
> than for
> > services, except you need a ServiceCategory object,
> >       not a ServiceAction). Then put this service category in the  
> menu
> > you want to insert your items in, and put you items in
> >       this category instead.
> >
> >
> >       While checking this procedure, I actually found that there  
> is a
> > difference of behavior between version 6706 and version 6713
> >       of squeak preventing this to work:  
> Object>>#perform:orSendTo: has
> > been modified between the two version.
> >
> >       The bottomline is that the following method should be added:
> >
> >       ServiceAction >> perform: selector orSendTo: otherTarget
> >               ^ self perform: selector
> >
> >
> >       Stef, could you put that in the update stream?
> >
> >       Diego, feel free to ask further question if you need to.
> >
> >               Romain
> >
> >
> > Il giorno Jan 21, 2006, alle ore 8:21 PM, stéphane ducasse ha  
> scritto:
> >
> >> Hi diego
> >>
> >> I have been discussing with lukas and we would love to have the
> >> possibility to auto categorise the categories in Browsers and in
> >> particular OmniBrowser. So keep doing your work, I would really
> >> like to include it in the 3.9 full.
> >>
> >>> I'm trying to do tools to simplify testing and check "quality" of
> >>> packages before saving them (thanks Steph and Lucas your
> >>> recommendations on how to do code coverage save me a lot of work).
> >>> I want to do some simple services:
> >>>    - a menu option to run unit tests of a category
> >>>    - a menu option to browse unit test/tested class
> >>>    - a menu option to auto categorize uncategorized method (so
> >>> the AutomaticMethodCategorizer doesn't have to overwrite the
> >>> Browser class)
> >>>
> >>> And I trying to figure out how to make a new "service", but I
> >>> can't figure out what is the correct way to do that.
> >>>
> >>> I must create a subclass of ServiceProvider and implement
> >>> #providedCategories?
> >>
> >> I do not think so. Your services can be defined as extension of
> >> BrowserProvider (may be I'm wrong).
> >> Look at ServiceAction comment (it is a bit obsolete). Romain do
> >> you have a more up to date version.
> >>
> >>
> >>> If this is the case, what is the meaning of the symbol array of
> >>> arrays returned by this method?
> >>>
> >>> small critic/question follows:
> >>> Why #providedCategories returns an array of symbols and not an
> >>> object that reifies the provided categories?
> >>
> >> Stef
> >>
> >
> > --
> >     Romain Robbes
> >     http://www.inf.unisi.ch/~robbes/
> >
> >
> >
>
>