A question about packaging

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

A question about packaging

Long Haired David
Hi everyone. I have been using Pharo sine I got my M1 MacBookAir in late December. Before then, I was a VAST user since around 1995.

I have a question about packaging. Example, in VAST, I have an Application called Family_Accounts. Inside that I have some classes such as FAEntry, FABudget and so on. If I wanted to extend String to add an instance to convert to ScaledDecimal but using my special amount strings. I select the New menu item and then select either a class or an extension. As I want to extend String, I select Extension and then, within my Family_Accounts, I can see the String class so that I can extend it.

In Pharo, I can have a package called Family_Accounts. I can extend String, OK  but my extension stays within the original package with, optionally, a Family_Accounts classification.  I can’t see how to add String to the Family_Accounts package to keep everything together in one place. Can this be done?

David
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: A question about packaging

Sven Van Caekenberghe-2
Hi David,

> On 16 Feb 2021, at 20:49, David Pennington <[hidden email]> wrote:
>
> Hi everyone. I have been using Pharo sine I got my M1 MacBookAir in late December. Before then, I was a VAST user since around 1995.
>
> I have a question about packaging. Example, in VAST, I have an Application called Family_Accounts. Inside that I have some classes such as FAEntry, FABudget and so on. If I wanted to extend String to add an instance to convert to ScaledDecimal but using my special amount strings. I select the New menu item and then select either a class or an extension. As I want to extend String, I select Extension and then, within my Family_Accounts, I can see the String class so that I can extend it.
>
> In Pharo, I can have a package called Family_Accounts. I can extend String, OK  but my extension stays within the original package with, optionally, a Family_Accounts classification.  I can’t see how to add String to the Family_Accounts package to keep everything together in one place. Can this be done?
>
> David

Extension methods are placed in method categories named after the package, *Family_Accounts. With the Calypso Browser, the UI hides this. At the bottom right there is a checkbox to make your method an extension and to chose the package to place it in. It can be a bit hard to use or confusing, but it does work.

Also, once you have extensions, they will show up as a virtual package (sub) category, which is very nice to get an overview.

I am sure this is described in some documentation somewhere.

Sven
Reply | Threaded
Open this post in threaded view
|

Re: A question about packaging

Kasper Osterbye
As Sven said it is done using categories.

In practice I often use the small “extension” button in the lower right corner of the method editor of the browser. If you press that, the system comes up with a small menu of existing packages, and you can select yours.

— Kasper

> On 16 Feb 2021, at 21.08, Sven Van Caekenberghe <[hidden email]> wrote:
>
> Hi David,
>
>> On 16 Feb 2021, at 20:49, David Pennington <[hidden email]> wrote:
>>
>> Hi everyone. I have been using Pharo sine I got my M1 MacBookAir in late December. Before then, I was a VAST user since around 1995.
>>
>> I have a question about packaging. Example, in VAST, I have an Application called Family_Accounts. Inside that I have some classes such as FAEntry, FABudget and so on. If I wanted to extend String to add an instance to convert to ScaledDecimal but using my special amount strings. I select the New menu item and then select either a class or an extension. As I want to extend String, I select Extension and then, within my Family_Accounts, I can see the String class so that I can extend it.
>>
>> In Pharo, I can have a package called Family_Accounts. I can extend String, OK  but my extension stays within the original package with, optionally, a Family_Accounts classification.  I can’t see how to add String to the Family_Accounts package to keep everything together in one place. Can this be done?
>>
>> David
>
> Extension methods are placed in method categories named after the package, *Family_Accounts. With the Calypso Browser, the UI hides this. At the bottom right there is a checkbox to make your method an extension and to chose the package to place it in. It can be a bit hard to use or confusing, but it does work.
>
> Also, once you have extensions, they will show up as a virtual package (sub) category, which is very nice to get an overview.
>
> I am sure this is described in some documentation somewhere.
>
> Sven