On May 22, 2011, at 2:29 AM, Stefan Marr wrote:

> Hi:
> 
> On 22 May 2011, at 01:56, Benjamin wrote:
> 
>> The "problem" is that MethodReference were used either it was for a method 
>> or for a comment. And in this case, the selector was set to #Comment .
>> Now, there is SourcedMethodReference for methods, and CommentReference for 
>> comments.
>> 
>> So this example should be changed I guess.
> 
> 
> So, the proper implementation would be the following? (now uses 
> CommentReference)
> 
> changedMessageList
>       "Used by a message set browser to access the list view information."
> 
>       | messageList |
>       messageList := OrderedCollection new.
>       changeRecords associationsDo: [:clAssoc | | classNameInParts 
> classNameInFull |
>               classNameInFull := clAssoc key asString.
>               classNameInParts := classNameInFull findTokens: ' '.
> 
>               (clAssoc value allChangeTypes includes: #comment) ifTrue:
>                       [messageList add:
>                               (CommentReference class: (Smalltalk globals 
> classNamed: classNameInParts first))].
> 
>               clAssoc value methodChangeTypes associationsDo: [:mAssoc |
>                       (#(remove addedThenRemoved) includes: mAssoc value) 
> ifFalse:
>                               [messageList add:
>                                       (SourcedMethodReference new
>                                               setClassSymbol: 
> classNameInParts first asSymbol
>                                               classIsMeta: classNameInParts 
> size > 1 
>                                               methodSymbol: mAssoc key 
>                                               stringVersion: classNameInFull, 
> ' ' , mAssoc key)]]].
>       ^ messageList asArray sort
> 
> 
> 
> Well well, thats not really nice. CommentReference is not entirely 
> polymorphic to MethodReference.
> 
> It should have 
> CommentReference>>#category
>       ^ self actualClass category
> 

So let's add it ^^


Ben


> to be able to move #topLevelPackageName from MethodReference to 
> SourceReference. Every piece of source is part of some package, no? Including 
> the class comments. Well, at least it breaks our file-out mechanism if that 
> is not true.
> 
> Best regards
> Stefan
> 
>> 
>> 
>> 
>> Ben
>> 
>> 
>> On May 21, 2011, at 11:41 PM, Stefan Marr wrote:
>> 
>>> Hello:
>>> 
>>> The following example is broken:
>>> 
>>> ChangeSet new commentClass: ChangeSet; changedMessageList
>>> 
>>> It will raise an exception that no #Comment message was found in the 
>>> ChangeSet class.
>>> (BTW: the key not found error does not name the key, which is rather 
>>> inconvenient)
>>> 
>>> The reason seems to be a change in ChangeSet>>#changedMessageList.
>>> 
>>> The change is tracked as being done by Benjamin Van Ryseghem (11/6/2010 
>>> 22:11)
>>> and seems to switch from MethodReference to SourcedMethodReference, which 
>>> breaks the example.
>>> 
>>> Does anyone know the intention or context of this change?
>>> Is it possible to revert to Marcus' pervious version of that method?
>>> 
>>> A test for this bug could be the lines of:
>>> 
>>> 
>>> 
>>> testChangedMessageListAndComments
>>>     | changeSet |
>>>     changeSet := ChangeSet new.
>>>     changeSet commentClass: ChangeSet.
>>>     self assert: 1 equals: changeSet changedMessageList size.
>>>     self assert: ((changeSet at: 1) isKindOf: MethodReference).
>>>     self assert: #Comment equals: (changeSet at: 1) methodSymbol.
>>> 
>>> Best regards
>>> Stefan
>>> 
>>> -- 
>>> Stefan Marr
>>> Software Languages Lab
>>> Vrije Universiteit Brussel
>>> Pleinlaan 2 / B-1050 Brussels / Belgium
>>> http://soft.vub.ac.be/~smarr
>>> Phone: +32 2 629 2974
>>> Fax:   +32 2 629 3525
>>> 
>>> 
>> 
>> 
> 
> -- 
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 2974
> Fax:   +32 2 629 3525
> 
> 


Reply via email to