Search code examples
smalltalkvisualworks

How to add a new method in Smalltalk source code?


I am new to Smalltalk and I am trying to add a new method in the Integer class present in Smalltalk. The method should go in the 'accessor' protocol. I am using VisualWorks and not finding any option to do that. I have gone through the developers guide still its not clear to me. Can someone please give me screen shots or step wise solution about how to proceed with it?


Solution

    1. Open your browser window [Small Talk Launcher --> System --> Browser]
    2. Select a Package
    3. Select a Class
    4. Select a Protocol to which you want to add your new method.

    You can find the tab "source" below the 4 partitions [Package, Class, Protocol, Method]. Replace the text in that "source" tab with the source code of your method.

    Go to to "edit" option in the Browser menu. Select "Accept" option.

    Your new method is added successfully!

    Cheers! Aditya.