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"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.
[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...
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.
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.
What you can do is put empty (or even non-empty!) comments between chunks of code, double-click just after the comment and everything up to (but not including) the start of the next comment will be selected.
""
myFoo do: [:each |
each bar
]
""
... and so on.Many years ago someone did produce a set of vim key bindings for some version of Squeak (ancestor of Pharo), never tried it and I've no idea how well it would work under Pharo. Googling for vim squeak will get you some starting points.
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.
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).
http://pharo.gemtalksystems.com/book/LanguageAndLibraries/Tr...
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?
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
also a forum for the mailing list can be found here -> http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.ht...
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.
Also put my money in there as a consortium member.
Really a great feel and awesome community.
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!
So, load balancing and monitoring you can do with things like nginx and monit.
Of course, I am no in the league of doing the next Twitter. It may keep up tough.
I am tying everything together with RabbitMQ, so scaling is doable.
Storage for blobs etc is in Riak.
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.
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
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.