Live data from Hacker News

Pharo: A malleable and powerful platform

slideshare.net

31–40 of 51 posts

Re: Pharo: A malleable and powerful platform

#31
post #15

Side-topic question: is anything from the Smalltalk OO model that hadn't made its way into Ruby? I know that Matz took lots of ideas from Smalltalk when he created Ruby, but I wonder if there are any good OO model related things he didn't adopt. I don't mean the whole image based and IDE in the program thing, I know this is something only Smalltalk has.

Depends on what you mean by OO model. One of the most important things about Smalltalk is 'thisContext'.

The various links referenced from:

http://stackoverflow.com/questions/6347599/how-does-smalltal...

Should give you a good idea.

Basically, the current call stack is available. This makes it trivial to write a debugger, restart processing from a previous point in execution (debugger driven development as it is sometimes called makes the TDD process make so much sense when you do it in Smalltalk).

Re: Pharo: A malleable and powerful platform

#32
post #16
post #9

Very nice - even managed to duplicate the demo with a bit of effort (once I got 32bit gl librarires installed in my 64bit ubuntu and got the standard 3.0 image/vm to start...). Now, it appears one can do/print with ctrl-d/ctrl-p -- and that it will work for the current line, eg: 1 + 1 "prints 2" But how about blocks? Is there a reasonable alternative to either selecting with the mouse, or with shift-arrow? As far as…

yes blocks are also evaluated with cmd+d. So its possible this way to evaluate/execute multiple smalltalk statements (message sends). so you can do a := [ message . message . message . ].a value. if you just ctrl+d it will execute all messages. "a value" executes the body of the block. also in pharo like emacs and vim , shortcuts are tied to methods so you can add a shortcut for any method you want. And since pharo h…

Ok, thanks :-)

[edit: also, yes "blocks" was an unfortunate choice of words earlier, I did mean logical blocks of code, not actual Smalltalk blocks. Like typing in the text in the demo-example above and having it all evaluate (or if not all, maybe the first and second half separately).]

I guess I'm leaning a little in the direction of the "tagline" of GNU smalltalk ("The Smalltalk for those who can type").

I'm not entirely sure I really want a "vim" mode -- but some form of keyboard-driven modal editing/editor/browser-thingy would be good, I think. I definitively need an interface that is (fully) usable without the mouse, due to wrist-strain.

On a similar note, this looks very promising (both as a VM and as inspiration for shorcuts):

http://forum.world.st/Tiling-Window-Manager-status-update-td...

Will have to find out if it works under Pharo 3.0...

Re: Pharo: A malleable and powerful platform

#33
post #6
post #2

I've always considered playing with Pharo (and Seaside). I just... I dabble in a lot of languages, and struggle to make certain ones fit in my toolbox, at times. Where would you put Pharo? Should I attempt web development in it? Server-side apps? Basically, what sort of development takes full advantage of the super-awesome neat features that Smalltalk gives you? Or am I thinking about it the wrong way?

Well the coding universe is divided into 3 galaxies. The C galaxy that dominates desktop , the Java galaxy and the Javascript galaxy. Of course there are other galaxies too, but I think those 3 dominate currently. For C libraries you can use Pharo. Pharo has inherited 2 FFIs from Squeak and has implemented 1 additional FFI called Nativeboost which also allows you to inline assembly code for best performance. There is…

You forgot to mention it is also an OS. :)

Re: Pharo: A malleable and powerful platform

#34
post #30
post #27

Earlier quoted context omitted.

Definitely a matter of taste then. The other think I like about Python and why I find it more readable is the usage of snake_case instead of camelCase. I'd take Door.open(1, times=3, close_after_ms=30) over Door open: 1 times: 3 andCloseAfterMilliseconds: 30 anytime :)

doable with smalltalk too Door open: 1 times: 3 and_close_after_ms: 30 also please note here, that python does not usually use keyword arguments. Unless for cases of optional arguments. So the python you wrote is completely doable of course, BUT not that used as often. So it will be Door.open(1,3,30) a lot more than Door.open(1, times=3, close_after_ms=30). This is where smalltalk shines, its culture. Those code habi…

aBlock := [:times :delay | times timesRepeat: [ door open. (Delay milliseconds:delay) wait. door close ]].

aBlock value: 3 value: 30.

Re: Pharo: A malleable and powerful platform

#35
post #6
post #2

I've always considered playing with Pharo (and Seaside). I just... I dabble in a lot of languages, and struggle to make certain ones fit in my toolbox, at times. Where would you put Pharo? Should I attempt web development in it? Server-side apps? Basically, what sort of development takes full advantage of the super-awesome neat features that Smalltalk gives you? Or am I thinking about it the wrong way?

Well the coding universe is divided into 3 galaxies. The C galaxy that dominates desktop , the Java galaxy and the Javascript galaxy. Of course there are other galaxies too, but I think those 3 dominate currently. For C libraries you can use Pharo. Pharo has inherited 2 FFIs from Squeak and has implemented 1 additional FFI called Nativeboost which also allows you to inline assembly code for best performance. There is…

"Smalltalk is that extremely rare case of software that it makes coding just flow, with no interruptions and no small annoyances. We call this style of coding "Live Coding" and its definetly the biggest reason to try smalltalk and even more try Pharo."

These couple of sentences give the reason that made me persist with Smalltalk (Pharo mostly). For those of you who come from, say Python, Java, C#..., this may be unsettling at first. The way you use the debugger to point you in the right direction and keep working without stopping. It feels all wrong in other, more pedestrian languages.

Re: Pharo: A malleable and powerful platform

#36
post #28
post #25

Earlier quoted context omitted.

yeap definitely looks like it. I would not be surprised if Python has something similar too. For me OO is not the big reason to use smalltalk. For me the biggest reason is the whole live coding environment which is a big plus for workflow and speed of development. But maybe other smalltalkers could chime in with features I am not aware of. Also Pharo has Pooldictionaries , which are doing the same thing Traits are do…

Python has good multiple inheritance and as far as I've seen most sane people just use it to "emulate" mixins and even name their secondary parent classes like Feature1Mixin or DoesYTrait. Traits seem like a great idea, but the only other language where I've seen it under the Smalltalk name of "trait" is... brace yourself :) ...PHP 5.4+.

Scala has traits, to great effect.

Re: Pharo: A malleable and powerful platform

#37
post #6
post #2

I've always considered playing with Pharo (and Seaside). I just... I dabble in a lot of languages, and struggle to make certain ones fit in my toolbox, at times. Where would you put Pharo? Should I attempt web development in it? Server-side apps? Basically, what sort of development takes full advantage of the super-awesome neat features that Smalltalk gives you? Or am I thinking about it the wrong way?

Well the coding universe is divided into 3 galaxies. The C galaxy that dominates desktop , the Java galaxy and the Javascript galaxy. Of course there are other galaxies too, but I think those 3 dominate currently. For C libraries you can use Pharo. Pharo has inherited 2 FFIs from Squeak and has implemented 1 additional FFI called Nativeboost which also allows you to inline assembly code for best performance. There is…

If any language dominates the desktop it would be c++

Re: Pharo: A malleable and powerful platform

#38
post #9

Very nice - even managed to duplicate the demo with a bit of effort (once I got 32bit gl librarires installed in my 64bit ubuntu and got the standard 3.0 image/vm to start...). Now, it appears one can do/print with ctrl-d/ctrl-p -- and that it will work for the current line, eg: 1 + 1 "prints 2" But how about blocks? Is there a reasonable alternative to either selecting with the mouse, or with shift-arrow? As far as…

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 (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 or 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 from the context menu.

    MyTest new parse get.   
5. At the debugger prompt, click then right-click and choose . 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 or fromthe context-menu choose .

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

7. In the debugger click or as you like.

Re: Pharo: A malleable and powerful platform

#39
post #15

Side-topic question: is anything from the Smalltalk OO model that hadn't made its way into Ruby? I know that Matz took lots of ideas from Smalltalk when he created Ruby, but I wonder if there are any good OO model related things he didn't adopt. I don't mean the whole image based and IDE in the program thing, I know this is something only Smalltalk has.

Lisp has images too. Ruby copies the Smalltalk OO model pretty closely but what Smalltalk has that Ruby doesn't is automated refactoring, that ability comes from being image based rather than file based. Ruby is a very practical modern Smalltalk frankly.
Post reply on HN