The Inbox: PackageInfo-Base-bf.65.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: PackageInfo-Base-bf.65.mcz

commits-2
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]!

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!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: PackageInfo-Base-bf.65.mcz

Chris Muller-3
-1 on the dramatic 'THIS PACKAGE HAS NO COMMENT'.  nil is the standard
and sufficient way to indicate the package has no comment.

As far as even having a comment variable -- could you explain how
PackageInfo is intended to be used -- e.g., what code would be calling
the comment: setter?

Thanks.


On Sat, Jul 28, 2012 at 4:31 PM,  <[hidden email]> 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]!
>
> 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!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: PackageInfo-Base-bf.65.mcz

Bert Freudenberg
On 28.07.2012, at 16:02, Chris Muller wrote:

> -1 on the dramatic 'THIS PACKAGE HAS NO COMMENT'.  nil is the standard
> and sufficient way to indicate the package has no comment.

The default comment is never stored in the package. It's just used in the interface if there is no comment.

My idea was to mimic how a missing class comment was displayed, but now I see that instead, the system browser shows a template for the class comment. I misremembered.

So a better default might be "Description of this package"?

> As far as even having a comment variable -- could you explain how
> PackageInfo is intended to be used -- e.g., what code would be calling
> the comment: setter?

No code currently uses that setter. MC deals with the StringHolder directly.

This is exactly the same as the preamble/unload scripts.

- Bert -

>
> On Sat, Jul 28, 2012 at 4:31 PM,  <[hidden email]> 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]!
>>
>> 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!
>>
>>
>




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: PackageInfo-Base-bf.65.mcz

Levente Uzonyi-2
In reply to this post by commits-2
On Sat, 28 Jul 2012, [hidden email] 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?

>
> 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.


Levente

>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: PackageInfo-Base-bf.65.mcz

Bert Freudenberg

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

> On Sat, 28 Jul 2012, [hidden email] 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 -