[Pharo-dev] ClassCommented is only announced if string is a RemoteString

Martin Dias tinchodias at gmail.com
Fri Nov 15 04:46:36 EST 2013


I was trying to figure out how to delegate somebody else the knowledge of
the file number:

RemoteString newString: aString onFileNumber: 2


I was thinking in a replacement like:

SourceFiles newRemoteStringWith: aString


or:

 SourceFiles oldRemoteStringAt: aSourcePointer


And let a SourceFileArray instance decide what's the file number.

But it's not so easy. In other methods (I think related to condensing the
file or filing out), it's also specified the filestream:

RemoteString newString: self organization classComment onFileNumber: 2
> toFile: aFileStream


Martín


On Thu, Nov 14, 2013 at 7:51 PM, Stéphane Ducasse <stephane.ducasse at inria.fr
> wrote:

> I hate this code.
> I had to work with it so many times when I extracted all the squeak
> version to load them in VW to be analysed
> in Moose (and sadly nobody did anything with them) I should have started
> to publish ideas on them - silly me.
>
> Stef
>
> On Nov 14, 2013, at 5:52 PM, Martin Dias <tinchodias at gmail.com> wrote:
>
> Hi
>
> Any idea why the "aString isKindOf: RemoteString" is there?
>
> In TClassDescription:
>
> classComment: aString stamp: aStamp
>>
>>  "Store the comment, aString or Text or RemoteString, associated with
>>> the class we are organizing.  Empty string gets stored only if had a
>>> non-empty one before."
>>
>>
>>>  | pointer header file oldCommentRemoteString oldComment oldStamp |
>>
>>  oldComment := self organization classComment.
>>
>>  oldStamp := self organization commentStamp.
>>
>>
>>> (aString isKindOf: RemoteString) ifTrue: [
>>
>>  SystemAnnouncer uniqueInstance
>>
>>  class: self
>>
>>  oldComment: oldComment
>>
>>  newComment: aString string
>>
>>  oldStamp: oldStamp
>>
>>  newStamp: aStamp.
>>
>>  ^ self organization classComment: aString stamp: aStamp].
>>
>>
>>>  oldCommentRemoteString := self organization commentRemoteStr.
>>
>>  (aString size = 0) & (oldCommentRemoteString isNil) ifTrue: [^ self
>>> organization classComment: nil].
>>
>>  "never had a class comment, no need to write empty string out"
>>
>>
>>> pointer := oldCommentRemoteString
>>
>>  ifNil: [0]
>>
>>  ifNotNil: [oldCommentRemoteString sourcePointer].
>>
>>   (file := SourceFiles at: 2) ifNotNil: [
>>
>>  file setToEnd; cr; nextPut: $!. "directly"
>>
>>  "Should be saying (file command: 'H3') for HTML, but ignoring it here"
>>
>>  header := String streamContents: [:strm | strm nextPutAll: self name;
>>
>>  nextPutAll: ' commentStamp: '.
>>
>>  aStamp storeOn: strm.
>>
>>  strm nextPutAll: ' prior: '; nextPutAll: pointer printString].
>>
>>  file nextChunkPut: header].
>>
>>   self organization
>>
>>  classComment: (RemoteString newString: aString onFileNumber: 2)
>>
>>  stamp: aStamp.
>>
>>   SystemAnnouncer uniqueInstance
>>
>>  class: self
>>
>>  oldComment: oldComment
>>
>>  newComment: aString
>>
>>  oldStamp: oldStamp
>>
>>  newStamp: aStamp
>>
>>
> (nice method eh!)
>
> Martín
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131115/8a4b6573/attachment-0002.html>


More information about the Pharo-dev mailing list