Sunday, March 1, 2009

Confused by newspeak

Having downloaded and Newspeak I'm faced with the same difficulty that I usually get when trying to start with smalltalk; culture clash. The world is unfamiliar and I don't know where to begin. To be sure Newspeak is much more familiar than Squeak; it has a browser like interface that behaves rather like a browser window and buttons whose icons make sense. There's still some rough edges like for example pressing tab doesn't change focus to the next control, but if one is prepared to use the mouse once can get around the UI and inspect the code.

But where to begin. Following the tutorial I found myself looking at a combinatorial parse and looking for simple function to understand. It's all a bit alien, gone is the familiar assignment operations, they're replaced by a double colon operator:

pos:: 0

which does assignment. But one can learn syntax. Looking at a simple function that is producing an error message it says something like:

or:: ifTrue: [msg2 ifTrue: 'or' ifFalse ''] msg1 ifFalse: '' .
^msg1 . org . msg2 .

which took me much longer to parse than the following would.

if msg1 && msg2 then
msg1 + "or" + msg2
else
msg1 + msg2
end

or even

[msg1, msg2].selectNotNil.join(' or ')

So I'm suspicious that the syntax is actually a good syntax. I think there should be syntactic sugar.

But these differences I understand. Where I'm lost is how do I interact with this system, how to I run code and execute it, where do I start making classes and what libraries do I have at my disposal. Where is my familiar command line where I can type in commands and have them evalulated when I press something like return or control-return.

I think I need a tutorial in which one creates a real application that does something, for example an application which checks on the price of a book on Amazon. That would show how to use the network layer, how to create a simple GUI window, how to loop in the background etc.

Well perhaps there is such a tutorial out there. I'll have to keep looking. For now, not being able to tab around the UI makes using Newspeak rather difficult on Eepc.

1 comment:

Gilad Bracha said...

Hi Richard,

Sorry you have been having a hard time. The download comes with a PDF that answers these exact questions. For example, there are sections like 'How do I evaluate code', and takes you from printing a line of code through creating a simple window and on to a fairly substantive interactive application.

Feel free to ask questions and or join the forum.

And thanks for trying something new!