[Pharo-project] Proposal to refactor MethodFinder with pragmas
Currently MethodFinder uses a list of acceptable selectors to execute. This list of selectors is not maintained which results in a lot of selectors to exist only in this list as they have been removed in the system. I propose to use pragmas on classes to generate this list automatically. Here is an example Magnitude class>>finderApprovedMethods <finderApproveInstanceMethod: #max:> <finderApproveInstanceMethod: #min:> <finderApproveInstanceMethod: #min:max:> <finderApproveInstanceMethod: #< > <finderApproveInstanceMethod: #<= > <finderApproveInstanceMethod: #< > <finderApproveInstanceMethod: #<= > <finderApproveInstanceMethod: #between:and: > What do you think? -- Damien Cassou http://damiencassou.seasidehosting.st "Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
What about only to use a pragma directly in the methods that will inform that the method has no side effect and doesn't modify the state of the object? This information may be used not only for the MethodFinder. -- Pavel On Fri, Jun 24, 2011 at 11:25 AM, Damien Cassou <damien.cassou@gmail.com> wrote:
Currently MethodFinder uses a list of acceptable selectors to execute. This list of selectors is not maintained which results in a lot of selectors to exist only in this list as they have been removed in the system. I propose to use pragmas on classes to generate this list automatically.
Here is an example
Magnitude class>>finderApprovedMethods    <finderApproveInstanceMethod: #max:>    <finderApproveInstanceMethod: #min:>    <finderApproveInstanceMethod: #min:max:>    <finderApproveInstanceMethod: #< >    <finderApproveInstanceMethod: #<= >    <finderApproveInstanceMethod: #< >    <finderApproveInstanceMethod: #<= >    <finderApproveInstanceMethod: #between:and: >
What do you think?
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
On Fri, Jun 24, 2011 at 11:34 AM, Pavel Krivanek <pavel.krivanek@gmail.com> wrote:
What about only to use a pragma directly in the methods that will inform that the method has no side effect and doesn't modify the state of the object? This information may be used not only for the MethodFinder.
I would prefer your solution. But since there is currently no other user for this pragma, the result would be the same cluttering that people complained with previously. What do others think? -- Damien Cassou http://damiencassou.seasidehosting.st "Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
Why not something like Magnitude class>>finderApprovedMethods ^ {#max: . #min: . #min:max: . #< . ... } It is shorter and less magic is involved here. It will also be probably faster to do a query. Cheers, Alexandre On 24 Jun 2011, at 05:25, Damien Cassou wrote:
Currently MethodFinder uses a list of acceptable selectors to execute. This list of selectors is not maintained which results in a lot of selectors to exist only in this list as they have been removed in the system. I propose to use pragmas on classes to generate this list automatically.
Here is an example
Magnitude class>>finderApprovedMethods <finderApproveInstanceMethod: #max:> <finderApproveInstanceMethod: #min:> <finderApproveInstanceMethod: #min:max:> <finderApproveInstanceMethod: #< > <finderApproveInstanceMethod: #<= > <finderApproveInstanceMethod: #< > <finderApproveInstanceMethod: #<= > <finderApproveInstanceMethod: #between:and: >
What do you think?
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
It is an extra list that has to be maintained. And what package will own this method? -- Pavel On Fri, Jun 24, 2011 at 2:26 PM, Alexandre Bergel <alexandre.bergel@me.com> wrote:
Why not something like
Magnitude class>>finderApprovedMethods     ^ {#max: . #min: . #min:max: . #< . ... }
It is shorter and less magic is involved here. It will also be probably faster to do a query.
Cheers, Alexandre
On 24 Jun 2011, at 05:25, Damien Cassou wrote:
Currently MethodFinder uses a list of acceptable selectors to execute. This list of selectors is not maintained which results in a lot of selectors to exist only in this list as they have been removed in the system. I propose to use pragmas on classes to generate this list automatically.
Here is an example
Magnitude class>>finderApprovedMethods    <finderApproveInstanceMethod: #max:>    <finderApproveInstanceMethod: #min:>    <finderApproveInstanceMethod: #min:max:>    <finderApproveInstanceMethod: #< >    <finderApproveInstanceMethod: #<= >    <finderApproveInstanceMethod: #< >    <finderApproveInstanceMethod: #<= >    <finderApproveInstanceMethod: #between:and: >
What do you think?
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel  http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Yes we were wondering with igor why using pragmas and that a simple list would be enough. Stef On Jun 24, 2011, at 2:26 PM, Alexandre Bergel wrote:
Why not something like
Magnitude class>>finderApprovedMethods ^ {#max: . #min: . #min:max: . #< . ... }
It is shorter and less magic is involved here. It will also be probably faster to do a query.
Cheers, Alexandre
On 24 Jun 2011, at 05:25, Damien Cassou wrote:
Currently MethodFinder uses a list of acceptable selectors to execute. This list of selectors is not maintained which results in a lot of selectors to exist only in this list as they have been removed in the system. I propose to use pragmas on classes to generate this list automatically.
Here is an example
Magnitude class>>finderApprovedMethods <finderApproveInstanceMethod: #max:> <finderApproveInstanceMethod: #min:> <finderApproveInstanceMethod: #min:max:> <finderApproveInstanceMethod: #< > <finderApproveInstanceMethod: #<= > <finderApproveInstanceMethod: #< > <finderApproveInstanceMethod: #<= > <finderApproveInstanceMethod: #between:and: >
What do you think?
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
participants (4)
-
Alexandre Bergel -
Damien Cassou -
Pavel Krivanek -
Stéphane Ducasse