

Pharo: A malleable and powerful platform - jsmorph
http://www.slideshare.net/pharoproject/pharo-tutorial-at-ecooptutorial

======
e12e
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 <ctrl-p> "prints 2"
    

But how about blocks? Is there a reasonable alternative to either selecting
with the mouse, or with shift-arrow? As far as I can tell even simple "two-
liners" force my fingers off of home row...

Also anyone happen to know if there's a usable vim-like interface/editor/thing
for pharo (other than just starting vim and copy/pasting)?

For the curious, I got this to work (just copy-paste into a Workspace. Note
that I had to change getGif with getJpeg -- but I'm not yet sure how to "live
patch" that properly, for now I just abandoned the stack trace, fixed the code
and evaluated again (the last line):

    
    
            Gofer it
                squeaksource: 'MetacelloRepository';
                package: 'ConfigurationOfXMLSupport';
                load.
    
            (Smalltalk at:#ConfigurationOfXMLSupport) project latestVersion load.
    
            Gofer new
                            squeaksource:  'XMLSupport';
                            package:  'XML-Parser'; load. 
    
            "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'.
    
            (ZnEasy getJpeg: url) asMorph openInHand .  "Opens image"

~~~
kilon
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 has over 70 thousands
methods , you will need a pile of keyboards :D

We could implement also a more convenient way of executing multiple lines in a
workspace. Generally in Pharo we spent most of our time with system browser
and debugger and much less with workspace. Workspace is more for one liners.
There is also already a tons of shortcuts, I am new with pharo so maybe there
is something already I am not aware of.

Also I don't mind using the mouse now and then. I find it harder to remember
tons of keyboard shortcuts. But I am moving slowly to a more keyboard
orientated workflow.

~~~
e12e
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...](http://forum.world.st/Tiling-Window-Manager-status-update-
td3561695.html)

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

------
girvo
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?

~~~
kilon
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 also the extra option of
making VM plugin with smalltalk or C code which in turn interface with C
libraries.

For Java there is redline smalltalk, but it does not come with the IDE. It can
use Java libraries out of the box.

And for Javascript there is amber, it comes with the smalltalk IDE but its
still a WIP, so its not as extensive as pharo. It can use javascript libraries
out of the box.

Smalltalk is a chameleon , its a language and an IDE made to fit in any case
scenario. I think you will have a real hard time proving that its tool best
used for specific scenarios, even in cases where OO approach is ideal,
smalltalk approach could be ideal because it still has one of the most
powerful OO systems plus refactoring tools, plus IDE, plus many nice toys.

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.

Give a try and register in our mailing list, you will find many people
passionate about smalltalk and yet a very welcome atmosphere for beginners.

I am also a recent convert to Pharo from Python. I love Python but I dont miss
it. So far Pharo has been very productive , fun and eye opening experience.

You can find more info here -> [http://www.pharo-
project.org/home](http://www.pharo-project.org/home)

also a forum for the mailing list can be found here ->
[http://forum.world.st/Pharo-Smalltalk-
Developers-f1294837.ht...](http://forum.world.st/Pharo-Smalltalk-
Developers-f1294837.html)

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

~~~
kilon
I am using TIOBE INDEX as reference. According to TIOBE not only C++ is not
even half as popular as C, but its also on a steady decline.

[http://www.tiobe.com/index.php/content/paperinfo/tpci/index....](http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html)

Though I agree "dominates" maybe a bit too heavy of a word to describe the
desktop landscape.

------
philippeback
Currently doing web and backend stuff with it. Works very well.

Also put my money in there as a consortium member.

Really a great feel and awesome community.

~~~
girvo
Neat! What sort of web stuff? Using Seaside or something else?

Do you think you could send me an email (in my profile here), I'd love to pick
your brains about using Pharo in production!

~~~
kilon
Seaside is one approach, there is also Aida-Web. Those are implemented in
pharo.

with Amber you can use also node.js if you want. And any server side node.js
library you can get your hands on. Amber can use any js library.

You could even mix amber, pharo , node.js and seaside / aida-web .Sky is the
limit. Its up to you which specific approach you will choose. You definitely
have loads of options.

~~~
philippeback
I had a shot at Aida-Web, not my cup of tea. Does the job though. Amber is
another beast, and is a very good option for single page web apps. Can do
proxying of JavaScript objects, so you can harness whatever you like in your
code and use the JS API the Smalltalk way. Which is kind of cool. With the
Helios IDE, it is a killer. Needs a while to master but worth the time.

~~~
kilon
What you did not like about Aida-Web ? I am no web dev ( I prefer GUIs ,
graphics and sound) myself just curious.

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

~~~
kilon
Does Ruby have traits ?

[http://pharo.gemtalksystems.com/book/LanguageAndLibraries/Tr...](http://pharo.gemtalksystems.com/book/LanguageAndLibraries/Traits/)

~~~
nnq
Well, isn't the use case for traits the same as for mixins? ([http://www.ruby-
doc.org/docs/ProgrammingRuby/html/tut_module...](http://www.ruby-
doc.org/docs/ProgrammingRuby/html/tut_modules.html#S2))

~~~
kilon
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
doing for methods , for instance variables. Probably Ruby has something
similar too.

I really think highly of Ruby , its a really powerful language. The reason why
I chose python instead is that I can't stand the "Pearl" syntax. All these
weird symbols etc. Definitely not my thing and make code less readable to me.

But as a language Ruby looks great to me. So definitely would not recommend
against learning it :)

~~~
nnq
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+.

~~~
seanmcdirmid
Scala has traits, to great effect.

------
benjComan
I started using Pharo a year ago and its been a pleasure to work with. Great
community.

I really like the Syntax comparison (slides 46-49). And being able to
serialize the debugging context of a running program to a file that can be
stored for later

~~~
bromagosa
Unless you're used to the Smalltalk way, you'd never think serializing the
debugging context of a running program would have any use at all.

I'd never had dreamed it'd be possible to do what I do regularly in my
deployed web apps. When the error handler catches an error, it serializes the
error and emails it to me in a fuel file. I can then fire up my _local_ Pharo
environment, materialize the error, debug it with all its context, fix
whatever code I need to and push the changes to my monticello repo.

~~~
kilon
Wow thats really impressive . well done

------
endlessvoid94
I've been playing with Pharo (and seaside) for a couple days now, and I know
it's going to be painful to go back to normal tools.

~~~
philippeback
That's why I decided not to :-)

------
rufugee
Are there commercial applications done using Pharo? If so, what? It'd be nice
to see some examples of companies successfully using it.

~~~
benjComan
Slides 85-95. [http://www.pharo-project.org/about/success-
stories](http://www.pharo-project.org/about/success-stories)

------
ravestar
My favorite language. I wish Pharo all the best.

