[squeak-dev] The Inbox: PackageInfo-Base-bf.65.mcz

Bert Freudenberg bert at freudenbergs.de
Mon Jul 30 06:25:07 UTC 2012


On 29.07.2012, at 12:06, Levente Uzonyi wrote:

> On Sat, 28 Jul 2012, commits at source.squeak.org wrote:
> 
>> Bert Freudenberg uploaded a new version of PackageInfo-Base to project The Inbox:
>> http://source.squeak.org/inbox/PackageInfo-Base-bf.65.mcz
>> 
>> ==================== Summary ====================
>> 
>> Name: PackageInfo-Base-bf.65
>> Author: bf
>> Time: 28 July 2012, 2:20:30.545 pm
>> UUID: 52c0359f-bd7e-4f1f-9a33-95b5cef7abb4
>> Ancestors: PackageInfo-Base-bf.64
>> 
>> Add per-package comments.
>> 
>> =============== Diff against PackageInfo-Base-bf.64 ===============
>> 
>> Item was changed:
>> Object subclass: #PackageInfo
>> + 	instanceVariableNames: 'packageName methodCategoryPrefix preamble postscript preambleOfRemoval postscriptOfRemoval comment'
>> - 	instanceVariableNames: 'packageName methodCategoryPrefix preamble postscript preambleOfRemoval postscriptOfRemoval'
>> 	classVariableNames: ''
>> 	poolDictionaries: ''
>> 	category: 'PackageInfo-Base'!
>> PackageInfo class
>> 	instanceVariableNames: 'default'!
>> 
>> !PackageInfo commentStamp: 'bf 7/28/2012 14:11' prior: 0!
>> PackageInfo is used by the system to figure out which classes and methods belong to which package. By default, class categories and method categories are matched against my packageName, but subclasses could override this behavior.
>> 
>> For an interesting use of PackageInfo subclasses have a look at OMeta2. It presents the same code base as two different packages, one using decompiled code for bootstrapping, the other using the actual OMeta syntax.!
>> PackageInfo class
>> 	instanceVariableNames: 'default'!
>> 
>> Item was added:
>> + ----- Method: PackageInfo>>comment (in category 'preamble/postscript') -----
>> + comment
>> + 	^ comment ifNil: [
>> + 		comment := StringHolder new contents: self commentDefault]!
> 
> Wouldn't it be better to use the setter method here, to avoid the code
> duplication?

Indeed. I just wanted it to look exactly like the other methods already in PackageInfo. They should be changed too, but I wanted to avoid refactoring while introducing that new feature.

> 
>> 
>> Item was added:
>> + ----- Method: PackageInfo>>comment: (in category 'preamble/postscript') -----
>> + comment: aString
>> + 	comment := StringHolder new contents: aString!
>> 
>> Item was added:
>> + ----- Method: PackageInfo>>commentDefault (in category 'preamble/postscript') -----
>> + commentDefault
>> + 	^ 'THIS PACKAGE HAS NO COMMENT'!
>> 
>> Item was added:
>> + ----- Method: PackageInfo>>hasComment (in category 'preamble/postscript') -----
>> + hasComment
>> + 	^ self isScript: comment not: self commentDefault!
> 
> Shouldn't the first argument be self comment, instead of the instance variable comment? If the value of comment is nil (it is, before #comment or #comment: is sent), then it will be shown as if the package has comment.


No, hasComment should not create the StringHolder.

- Bert -




More information about the Squeak-dev mailing list