<div dir="ltr">Hernan,<div><br></div><div>I've hacked around it (basically manually wrapped the Interval in an OrderedCollection) but still think it's an issue we should address. To me, the problem is that there is a mutually exclusive design decision between those two methods that needs to be resolved. It's easy enough to work around once you understand what's going on but my thinking is that it shouldn't be something that users of it, from the outside, should need to concern themselves with since it's an issue between two methods inside the same class.</div><div><br></div><div>I did want to mention that the functionality these changes provide are great and thank you for them, so I'm not complaining about that. It does a wonderful job[1] and avoids messing things up with my custom parsers/compilers. It's just that one specific design detail that's causing me heartburn.</div><div><br></div><div>[1] One enhancement I thought about while using it is that Package and Image (exclusive of packages) scopes would be good additions at some point. This would be helpful for anyone porting packages.</div><div><br></div><div>Thanks for following up,</div><div>Phil</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 25, 2019 at 5:41 PM Hernan Wilkinson <<a href="mailto:hernan.wilkinson@10pines.com">hernan.wilkinson@10pines.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Phil<div> sorry for not answering you before.</div><div> Do you still need to add that range in your encoder? Maybe you can use what the current encoder is doing... let me know</div><div><br></div><div>Hernan.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 21, 2019 at 1:19 PM Phil B <<a href="mailto:pbpublist@gmail.com" target="_blank">pbpublist@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hernan,<div><br></div><div>Thanks for the detail... that clears up how we got here. So the question is how to best address the issue? The problem I'm running into is that I have an Encoder adding a range to sourceRanges via #noteSourceRange:forNode: (i.e. a singular range) but later Parser is attempting to add a range via #addMultiRange:for: which fails since Interval DNU #add:.[1] So we've got a logical inconsistency in that #noteSourceRange:forNode: can add a singular Interval while #addMultiRange:for: assumes it will always be a collection of Intervals. It would be nice if either #noteSourceRange:forNode: raised an exception/wrapped in a collection if a singular range gets passed to it or #addMultiRange:for: properly handled not finding a collection of ranges in sourceRanges. I don't have any particular preference, but it seems that the current implementation is at least incomplete.</div><div><br></div><div>[1] In my case, it's happening via my subclasses of Encoder and Parser but appears to be (previously) perfectly valid uses of both. So either the default code paths never attempt to do this or we've just gotten lucky so far? (have you tried recompiling the Image?)</div><div><br></div><div>Thanks,</div><div>Phil</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 21, 2019 at 8:10 AM Hernan Wilkinson <<a href="mailto:hernan.wilkinson@10pines.com" target="_blank">hernan.wilkinson@10pines.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Phill,<div> let me tell you the story about it :-)</div><div> Originally, the encoder only kept the ranges of message nodes because they are used in the debugger to highlight the message send when steeping.</div><div> As part of the implementation of refactorings, I changed the parser to keep the ranges of all parse nodes. </div><div> The thing is, there are parse nodes like a variable node or a literal node that can be reused in the AST and therefore for the same node you can have multiple ranges, that is where the ordered collection of ranges comes from. </div><div> I did not change how ranges for message send were stored to avoid further changes and keep compatibility with the rest of the tools that assumed that.</div><div> I know it is not nice to get an interval for some node types and a collection of intervals for others, they are not polymorphic and therefore it breaks encapsulation, but it was the "safest" way to do it due to the lack of tests and the difficulty to analyze a major change.</div><div> In the change set I sent that allows renames in the class definition, I added a message to MethodNode, #isMultipleRanges: that encapsulates the fact that a node can have one or multiple ranges.</div><div> Writing this email I realized we could add a new message to get node ranges that would always return a collection and at least for that message the return would be polymorphic always, no matter the node type... but making all the tools to use that message is another story :-)</div><div><br></div><div> Cheers!</div><div> Hernan.</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 21, 2019 at 1:55 AM Phil B via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I see that not too long ago that Encoder was modified to have #addMultiRange:for: use collections of Intervals for ranges in the sourceRanges dictionary. However, #noteSourceRange:forNode: still adds singular Intervals to sourceRanges which causes problems. Not sure how to best resolve this... (I tried a quick hack of having it also wrap its Intervals in collections which as expected caused problems elsewhere so figured I'd ask before going further)</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-2696118728722038809gmail-m_-7605758655782324709gmail-m_2427262945932242852gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></span></strong></span></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></span></strong></span></div><div><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-2696118728722038809gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></span></strong></span></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></span></strong></span></div><div><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>