Hacker News new | past | comments | ask | show | jobs | submit login

The second Gofer is not needed. The XML Support is all installed with the #load message.

I don't think you can live-patch a DoIt from Workspace. What you can try is create a test class and method. However you can demo this with the following exercise...

1. In a newly opened image, right-click the background and choose 'System Browser'

2. Fill in the template with #MyTest and 'MyTest' as follows...

    Object subclass: #MyTest
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'MyTest'
Press <ctrl-s> (on windows. or choose 'Accept' from the context menu - but the 3.0alpha I'm on has an error with this. works in 2.0)

3. Create a method by clicking on the "no message" protocol and replace the template with the following and save using <ctrl-s> or <Accept> from the context menu...

    parse
        | data doc entries entry content url |
        "Get the data, you can try and print this, if you want"
        data := 'http://picasaweb.google.com/data/feed/api/all?q=puppy' asUrl retrieveContents.

        "parse it"
        doc := XMLDOMParser parse: data.

        "split up"
        entries := doc
            allNodesSelect: [ :n | n name = 'entry' ].

        "pick one"
        entry := entries anyOne.

        content := entry
            nodesDetect:  [ :n | n name = 'content' ].
         
        url := content attributeAt: 'src'.
4. Create a second method

    get
        (ZnEasy getGif: url) asMorph openInHand .  "Opens image"
4. Evaulate the following in a Workspace with <DoIt> from the context menu.

    MyTest new parse get.   
5. At the debugger prompt, click <Debug> then right-click and choose <Full Stack>. Scroll down the call stack and select 'MyTest get'. (In my 3.0alpha you need to select it two times to highlight current position - something to clean up there)

6. Replace getGif: with getJpeg: and save using <ctrl-s> or fromthe context-menu choose <Accept>.

Observe that the call stack shrinks back so that 'MyTest get' is at the top of the call stack.

7. In the debugger click <Proceed> or <Over> as you like.




Further down some asked "is anything from the Smalltalk OO model that hadn't made its way into Ruby?" Well I don't know about OO model, but to extend my example above, at step 5 when the debugger appears, <Save & Quit> the image. Then copy the folder to another PC, open up the Pharo image, and continue with steps 6. and 7.

In days past with the predominance of the desktop, 'perhaps' the 'live image' concept central to Smalltalk had some logistic issues (for some) but I think in this day of applications running on remote web based systems, being able to store/download/restart the execution context that caused an exception is a great advantage.

Now if you don't want to download the size of whole image, you can download the debugging context only, and continue. See http://marianopeck.wordpress.com/2012/01/19/moving-contexts-....

The other interesting this is that VNC can connect directly into the image, so you can be directly using the GUI IDE Smalltalk tools on a remote server.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: