[Cuis-dev] Recent changes to Encoder (update 4156?)

Hernan Wilkinson hernan.wilkinson at 10pines.com
Mon Jun 1 11:26:31 PDT 2020


Hi Phil!
 I agree that we should convert the value of the ranges dictionary to a
collection of intervals and make them polymorphic once and for all. Sadly
that is a change that requires time and great care because it is used in
many places (parser, debugger, etc).
 I think the best change would be for AST nodes to know their range and get
rid of that dictionary in the encoder, that is something that Nahuel has
been analyzing lately but again, it is not an easy change.

I would like to avoid the problems we are generating to you with these
changes... are there tests we can run to be sure we have not break you
anything?

Cheers!
Hernan.


On Thu, May 28, 2020 at 3:48 AM Phil B via Cuis-dev <cuis-dev at lists.cuis.st>
wrote:

> Nahuel,
>
> Thanks for the response... it gave me a chance to calm down and take a
> closer look at what you changed...
>
> On Wed, May 27, 2020 at 5:51 PM Nahuel Garbezza <n.garbezza at gmail.com>
> wrote:
>
>> Hi Phil,
>>
>> As you were mentioning, the update #4156 enforces that
>> #noteSourceRange:forNode: should always receive an interval instead of a
>> collection. Before this update it worked with both intervals and collection
>> of intervals, kind of a "weird polymorphism" case (because the object was
>> only put into a dictionary, we didn't have any issues). When I looked at
>> all the senders of that message, I saw that we are always passing a single
>> range instead of a collection, that's why I went ahead with the change.
>>
>
> My issue with these changes since they were originally made was that the
> interface and internal representation, while simple, are rather ugly IMO.
> It looks like your changes are addressing the ambiguous interface (to a
> degree) but not the internal representation, which senders must still be
> aware of.  My code being outside of the changesets gets to see the ugliness
> first hand...
>
>
>>
>> I'm not sure if I understood correctly the issue you are having. Have you
>> tried using #addMultiRange:for: message? this one is for the nodes that
>> should have collections of source ranges (the nodes that have multiple
>> occurrences on the same AST, like variables). The reason for having two
>> messages for adding source ranges is for the user to explicitly decide when
>> to report a multi range vs. report a single range. Another option could be
>> to have a message like #noteSourceRanges:forNode: (note the plural) to be
>> used with a collection of source ranges, and report all source ranges at
>> once.
>>
>
> The issue is the parallel, yet incompatible, accessors of the same ivar
> (sourceRanges) depending on whether you want a singular range or a multi
> range.  As a result, the sender of the setter and getter must be
> coordinated on a per-node basis or you will have problems... which is what
> was happening with my code.
>
>
>> Happy to discuss alternatives to consider all possible use cases!
>>
>
> Why not just convert everything to use multi ranges (i.e. internally
> *always* store a collection in sourceRanges) and eliminate the issue of
> needing to be aware of the internal representation entirely?
>
>
>>
>> Thanks,
>> Nahuel
>>
>>
> Thanks,
> Phil
> --
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20200601/79c2ec75/attachment-0001.htm>


More information about the Cuis-dev mailing list