[Seaside-dev] slime rule to detect ajax requests that combine multiple primary callbacks

Lukas Renggli renggli at gmail.com
Sat Sep 1 16:15:18 UTC 2012


This gives you all the cascades in the image:

    ``@receiver `@head: ``@headArgs; `;@rest: ``@restArgs

Or even simpler if you don't care about the inner structure of the cascade:

    `{ :node | node isCascade }

Lukas

On 1 September 2012 17:47, Johan Brichau <johan at inceptive.be> wrote:
> Hi Lukas,
>
> Thanks for the response. That indeed is a more scalable solution.
> I don't seem to see a pattern to match cascades but perhaps it's sufficient to capture all statements that have a 'jQuery ajax' in there.
>
> Simple enough. I will commit a new version soon.
>
> cheers
> Johan
>
> On 01 Sep 2012, at 17:29, Lukas Renggli wrote:
>
>> Hi Johan,
>>
>> The proposed rule seems to be very useful.
>>
>> I would match all cascades with the pattern, and then in the action
>> block manually test if any of your selectors occurs more than once.
>>
>> Cheers,
>> Lukas
>>
>> On 1 September 2012 16:42, Johan Brichau <johan at inceptive.be> wrote:
>>> Hi,
>>>
>>> I just committed a new Slime rule to find methods that combine multiple primary callbacks on a jQuery ajax object: WADoNotCombineMultiplePrimaryAjaxCallbacks
>>> When I was optimizing all my ajax requests to combine as much secondary callbacks as possible (as opposed to using onComplete:), I made some mistakes and decided a Slime rule would really help detect those mistakes.
>>>
>>> Unfortunately, I'm not a hero on the AST pattern spec and it seems a lot of work to complete the rule's detection patterns with all possible combinations of messages (in a cascade) to the JQAjax object. Therefore I thought I would ask some feedback on how to best do that.
>>>
>>> The problem is thus that you just want to find out if any message that implements a primary callback is sent more than once in a cascade. Maybe the patterns are not good for that and I should just use some metaprogram?
>>>
>>> Any ideas are welcome.
>>>
>>> cheers
>>> Johan_______________________________________________
>>> seaside-dev mailing list
>>> seaside-dev at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>> _______________________________________________
>> seaside-dev mailing list
>> seaside-dev at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
> _______________________________________________
> seaside-dev mailing list
> seaside-dev at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev



-- 
Lukas Renggli
www.lukas-renggli.ch


More information about the seaside-dev mailing list