Deprecator

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

Deprecator

camille teruel
Hello Pharo users,

I'm pleased to announce the release of Deprecator.
It's a prototype of a small tool that permits you to deprecate method by annotating them with a <deprecated: ...> pragma.
This pragma takes a rewrite expression as argument that specifies how to rewrite the message send to the deprecated method. 
If such a deprecated method is executed, a warning is thrown and a debugger opens.
This debugger has a little 'Rewrite' button that permits to rewrite the sending method according to the rewrite expression and then resume the execution with the new rewritten sending method :)
The implementation is a proof-of-concept and is a bit hacky here and there, but it works. 

Example:

You have a class C with a method that you deprecate. 
Its rewrite expression tells that if it's executed as the result of a message send of the form: 
<receiver> deprecatedMethodArg1: <arg1> arg2: <arg2>
this message send should be rewritten to: 
<receiver> replacementMethodArg1: <arg2> arg2: <arg1>.
 Note you can change the order of arguments or even the receiver.
 
C>>deprecatedMethodArg1: o1 arg2: o2
<deprecated: '`@receiver replacementMethodArg1: `@arg2 arg2: `@arg1'>
  ^ #deprecated

C>>replacementMethodArg1: o1 arg2: o2
^ #replacement

C>>senderMethod
^ self deprecatedMethodArg1: 1 + 1 arg2: 2 + 2.

Then if you execute C new senderMethod, and then click on the "Rewrite" button of the debugger, then sending method is rewritten to:

C>>senderMethod
^ self replacementMethodArg1: 2 + 2 arg2: 1 + 1.

and the result is #replacement

The repo is on sSmalltalkHub:
MCHttpRepository
user: ''
password: ''

I hope for comments, feature suggestions, code reviews, contributors, etc :) 
BTW, if you have a better name for this project let me know! 
For example, I thought about Ammonite because it's an extinct animal (analogy with deprecated) and it fits the sea naming theme.

Cheers,
Camille
Reply | Threaded
Open this post in threaded view
|

Re: Deprecator

Sean P. DeNigris
Administrator
camille teruel wrote
This debugger has a little 'Rewrite' button
O.M.G. That is fantastic! Let's get this into core quickly!! Thanks :)

Regarding the name... while I get the value of cool, mysterious-sounding names for public-facing (or maybe at minimum cross-platform) projects, I'd rather these small tools that we often make be named as intention-revealing as possible. I've felt at times some unnecessary complication translating #(starfish shovel sandcastle) -> #(Socket Debugger Array) ;-p
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Deprecator

Marcus Denker-4

On 24 Jul 2014, at 16:14, Sean P. DeNigris <[hidden email]> wrote:

> camille teruel wrote
>> This debugger has a little 'Rewrite' button
>
> O.M.G. That is fantastic! Let's get this into core quickly!! Thanks :)
>
:-)

> Regarding the name... while I get the value of cool, mysterious-sounding
> names for public-facing (or maybe at minimum cross-platform) projects, I'd
> rather these small tools that we often make be named as intention-revealing
> as possible. I've felt at times some unnecessary complication translating
> #(starfish shovel sandcastle) -> #(Socket Debugger Array) ;-p
Indeed… I used to be a fan of cute names, but now when looking at the packages
it makes it very hard for people to understand what is what.

        Marcus
Reply | Threaded
Open this post in threaded view
|

Re: Deprecator

stepharo

>> Regarding the name... while I get the value of cool, mysterious-sounding
>> names for public-facing (or maybe at minimum cross-platform) projects, I'd
>> rather these small tools that we often make be named as intention-revealing
>> as possible. I've felt at times some unnecessary complication translating
>> #(starfish shovel sandcastle) -> #(Socket Debugger Array) ;-p
> Indeed… I used to be a fan of cute names, but now when looking at the packages
> it makes it very hard for people to understand what is what.

but this is just a tooling issue. With package metadata, people can add
information.
For example, if you add catalog metadata to a configuration, you get the
description in the fly by help.

Stef
>
> Marcus
>


Reply | Threaded
Open this post in threaded view
|

Re: Deprecator

Sean P. DeNigris
Administrator
stepharo wrote
but this is just a tooling issue
Tooling would certainly help, but I think the issue is a little deeper. It's about the amount of effort required to understand the purpose of the project. If you're scanning a list of titles of possible projects, and you see "DeprecationRewriter" or "MigrationHelper", you have an idea whether it's helpful or not, but something like "Playa" forces you to dig into the metadata you're talking about. Also, once the project is in core, the same applies to seeing "Debugger", "Compiler", etc in the browser
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Deprecator

stepharo
Yes but again this is a UI

Do you think that DynamicWebServer is better than Seaside :)?
Even VW people got it right this time. They webserver is called Sioux
Stef

>> but this is just a tooling issue
> Tooling would certainly help, but I think the issue is a little deeper. It's
> about the amount of effort required to understand the purpose of the
> project. If you're scanning a list of titles of possible projects, and you
> see "DeprecationRewriter" or "MigrationHelper", you have an idea whether
> it's helpful or not, but something like "Playa" forces you to dig into the
> metadata you're talking about. Also, once the project is in core, the same
> applies to seeing "Debugger", "Compiler", etc in the browser
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Deprecator-tp4769844p4769909.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Deprecator

camille teruel
In reply to this post by camille teruel

On 24 juil. 2014, at 18:11, Ben Coman <[hidden email]> wrote:

Camille Teruel wrote:

On 24 juil. 2014, at 17:05, stepharo <[hidden email]> wrote:

Camille

Ammonite is not that sezzy :)

Because it has tentacles? :-D

May be
autoRepair
selfRepair :)

Yes for example ;)

How about 'Reprecator'   because you are Rep(airing)(Dep)recations.

This one is fun :)




Stef
On 24/7/14 14:34, Camille Teruel wrote:
Hello Pharo users,

I'm pleased to announce the release of Deprecator.
It's a prototype of a small tool that permits you to deprecate method by annotating them with a <deprecated: ...> pragma.
This pragma takes a rewrite expression as argument that specifies how to rewrite the message send to the deprecated method. 
If such a deprecated method is executed, a warning is thrown and a debugger opens.
This debugger has a little 'Rewrite' button that permits to rewrite the sending method according to the rewrite expression and then resume the execution with the new rewritten sending method :)
The implementation is a proof-of-concept and is a bit hacky here and there, but it works. 

Example:

You have a class C with a method that you deprecate. 
Its rewrite expression tells that if it's executed as the result of a message send of the form: 
<receiver> deprecatedMethodArg1: <arg1> arg2: <arg2>
this message send should be rewritten to: 
<receiver> replacementMethodArg1: <arg2> arg2: <arg1>.
 Note you can change the order of arguments or even the receiver.
 
C>>deprecatedMethodArg1: o1 arg2: o2
<deprecated: '`@receiver replacementMethodArg1: `@arg2 arg2: `@arg1'>
  ^ #deprecated

C>>replacementMethodArg1: o1 arg2: o2
^ #replacement

C>>senderMethod
^ self deprecatedMethodArg1: 1 + 1 arg2: 2 + 2.

Then if you execute C new senderMethod, and then click on the "Rewrite" button of the debugger, then sending method is rewritten to:

C>>senderMethod
^ self replacementMethodArg1: 2 + 2 arg2: 1 + 1.

and the result is #replacement

The repo is on sSmalltalkHub:
MCHttpRepository
user: ''
password: ''

I hope for comments, feature suggestions, code reviews, contributors, etc :) 
BTW, if you have a better name for this project let me know! 
For example, I thought about Ammonite because it's an extinct animal (analogy with deprecated) and it fits the sea naming theme.

Cheers,
Camille




Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Deprecator

Sean P. DeNigris
Administrator
camille teruel wrote
 
> How about 'Reprecator'   because you are Rep(airing)(Dep)recations.
This one is fun :)
Ha ha ha, worth it for humor value alone!
Cheers,
Sean