[Cuis-dev] Removing unused temps from inside blocks

Hernan Wilkinson hernan.wilkinson at 10pines.com
Thu Dec 12 12:47:18 PST 2019


Did it!! and also it removes the | if no more temp var is defined :-)

At github now.

Cheers!
Hernan

On Thu, Dec 12, 2019 at 4:39 PM Hernan Wilkinson <
hernan.wilkinson at 10pines.com> wrote:

> I think I know how to fix it... instead of removing each variable, we
> should collect the ranges to remove and after going through all the temps
> remove them. That way there is no need to re parse... I'll give it a try
>
> On Thu, Dec 12, 2019 at 4:34 PM Hernan Wilkinson <
> hernan.wilkinson at 10pines.com> wrote:
>
>> Hi Eric,
>>  thank you for the fix! It is in github now.
>>
>>  Re-parsing is not a problem because methods are usually small in
>> Smalltalk and the parser is fast enough, but it introduces an issue: when
>> you say you don't want to remove the variable and then you remove another
>> one, it will ask you again for the first one.
>>  I integrated the change anyway because it is a rare condition and it is
>> better to remove unused temps on blocks.
>>  If you can fix that new issue, the better, but I think it will not be so
>> simple...
>>
>>  BTW, I also fixed another problem, it there was no temps in the method
>> but unused temps in a block, it did not work.
>>
>> Thanks!
>> Hernan.
>>
>> On Thu, Dec 12, 2019 at 3:03 AM Eric Brandwein via Cuis-dev <
>> cuis-dev at lists.cuis.st> wrote:
>>
>>> Sorry, I just realised this doesn't work if you're erasing many
>>> variables at a time. The obvious solution is to just reparse each time a
>>> temporary variable is removed, and that is what this new attached ChangeSet
>>> does.
>>>
>>> This is maybe slow, and I guess the alternative would be to go through
>>> all the declarations of all blocks inside the parsed method from the bottom
>>> to the top, so as to not change the positions of other possibly unused
>>> declarations when removing one of them. Let me know if this other solution
>>> seems better or if the one that reparses every time is fine.
>>>
>>> Cheers,
>>> Eric
>>>
>>> El jue., 12 dic. 2019 a las 2:23, Eric Brandwein (<
>>> brandweineric at gmail.com>) escribió:
>>>
>>>> Hi all,
>>>>
>>>> Currently, when you save a method with an unused temporary variable
>>>> declared, it prompts you to decide if you want to remove it or not. If you
>>>> click yes, it removes the declaration, but only if it's declared in the
>>>> method scope, and not if it is declared inside a block.
>>>>
>>>> To reproduce, just create a method with an unused temporary variable
>>>> declared inside a block, save it, and click 'Yes' on the popup that appears.
>>>>
>>>> This is because the Parser only looks for the variable in the temps
>>>> declared in the method scope. Here's a ChangeSet that fixes it making the
>>>> Parser look inside blocks too, taking advantage of the fact that the
>>>> Encoder has already found the positions for each variable.
>>>>
>>>> Cheers,
>>>> Eric
>>>>
>>> --
>>> Cuis-dev mailing list
>>> Cuis-dev at lists.cuis.st
>>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>>
>>
>>
>> --
>>
>> *Hernán WilkinsonAgile Software Development, Teaching & Coaching*
>> *Phone: +54-011*-4893-2057
>> *Twitter: @HernanWilkinson*
>> *site: http://www.10Pines.com <http://www.10pines.com/>*
>> Address: Alem 896, Floor 6, Buenos Aires, Argentina
>>
>
>
> --
>
> *Hernán WilkinsonAgile Software Development, Teaching & Coaching*
> *Phone: +54-011*-4893-2057
> *Twitter: @HernanWilkinson*
> *site: http://www.10Pines.com <http://www.10pines.com/>*
> Address: Alem 896, Floor 6, Buenos Aires, Argentina
>


-- 

*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191212/238c7b15/attachment.htm>


More information about the Cuis-dev mailing list