[Newbies] smalltalk and squeak

Derek O'Connell doc at doconnel.f9.co.uk
Fri Nov 18 13:28:32 UTC 2011


On 18/11/11 12:52, dimitris chloupis wrote:
> First Thank you very much for replying and helping me understand.
>
>> The "inspector" displays the instance vars. Just to be certain, if you
>> have opened an actual inspector on a morph it will have three panes with
>> a list of instance vars in the left one. Select any var and its value is
>> displayed in the right pane. *With the mouse cursor over the right pane*
> Yes that is what I said I did . To be precise I created RectangleMorph via the "
> Supplies" flap and then right click on it and choose "inspect"
>
>> the value can then be edited followed by "accepting" any changes using
>> alt/ctrl-s or middle/right-click and selecting "accept" (the actual
>> modifier key and/or mouse button used will depend on your prefs). The
>> mouse cursor position is important to indicate where text will be
>> entered and no changes are made until you "accept" them.
> yes i did also that , and I know that the mouse cursor gives focus. I was able
> to enter the new value in "all inst vars" "border Width" , i then right click it
> and choose "accept" and then another window appears with the title "Syntax error".
> In the first panel it says RectangleMorphe<none>  Nothing and the panel underneath
> it , it display this error log
>
> "Nothing more expected ->bounds:     37 at 363 corner: 87 at 403
> owner:     a PasteUpMorph<world>(1622) [world]
> submorphs:     #()
> fullBounds:     37 at 363 corner: 87 at 403
> color:     (Color r: 0.613 g: 0.903 b: 1.0)
> extension:     a MorphExtension (1436) [externalName = Rectangle ]  [player = a Player64 (301) named Rectangle]  [other:  (borderStyle ->  a SimpleBorder) (decimalPlacePreferences ->  an IdentityDictionary(#getAlpha->2 #getX->0 ))]
> borderWidth:     10
> borderColor:     Color black
> "
> When I go back to inspector the value is reverted by to the old one and
> the morph never changes.

The normal way is to select the actual instance var you want to change. 
"all inst vars" is good for overview but I've never thought about 
attempting changes there, not sure it is even possible.

>
>> By "specific object" I think you mean "specific instance". You need to
>> realize the distinction between Classes and Instances.
> Sorry for the ommision of "instance" , I meant "class instance object"
> Yes I know the distiction, I have been programming just for fun since 1988
> though it was only last year that I did a serious app with it, specifically
> a Blender python addon which of course uses OOP. So I am not new to this
> but I am exremely new to smalltalk and squeak, start studying it
> only a few days ago. So I am not familiar yet with all the terminology
> smalltalkers use.
>
> This is my project
>
> http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/System/Gyes

Ah Blender, one of my all-time favourite programs and the reason I 
learnt Python :-)

-D

>> What you refer to  as "functions" is generally called "behaviour"
>> implemented as "methods" in classes and viewed via a Browser.
>> This behaviour is shared by all instances of a class while state specific
>   >  to each instance ("instance variables") is stored by the instance itself
>   >  and viewed in an inspector.
>
> As I said I am very new with smalltalk so I still use python terminology.
> Like smalltalk python use objects for everything from classes to basic
> types and functions.  "Everything is an object". And smalltalk methods
> and messages look very similar to python's functions and function calls.
>
> Yes I understand what you are saying and I understood also what
> Inspector does. What I did not understand is the previous error.
>
>> I'm guessing your question is really this: if I have a morph on screen
>> how can I manipulate it in a workspace? If so then click the menu button
>> on a workspace (blue button, downward pointing triangle) and select
>> "create textual references to dropped morphs". Then simply drag&drop a
>> morph over the workspace and a variable will be defined for it.
> Yeap that is exactly what i was asking, thank your answer does exactly
> what I wanted.
>
>> Btw, my guesswork above doesn't imply anything about you, it comes from
>> my own experience learning Squeak/Smalltalk where a certain degree of
>> familiarity is needed before I even understood what I was trying to ask.
>> Bit of a chicken&egg situation to begin with but the penny drops eventually.
>> Casey recommended a good book but I would suggest starting with
>> Squeak-by-Example to begin with:
> Absolutely and I want to read and learn . Downloading SBE and PBE was the first
> thing I did after downloading All in one Pharo and Squeak. My problem was that BEs
> are not well written, they jump from chapter 1 to complex concepts like debugging and
> unit testing , but that was not my problem as I am not a complete begineer with programming
> my problem was that it also made several jump while explaining objects too , and I find it
> very hard to follow in some cases, not always but in some cases. I manage to read 200 of 300
> pages of both books but even some repeats I realised they were not enough to get me started with
> squeak. So I did my google search and found "squeak by example" free pdfwhich does not
> hurry or make assumptions of what I know it just do it the way i want step by step and explaining
> practically everything it teaches.
>
> Via PBE and SBE I though that smalltalk followed a completely diffirent concept than python
> and now I understand more about it , I see they are very similar. "Smalltalk by example" is a very
> good book.
>
>> http://www.squeak.org/Documentation/
>> http://wiki.squeak.org/
> I have taken a look at wiki, but I must admit probably not as much as I should. But I promise
> I will from now on. I am still very new with all things smalltalk orientated so I am still trying to find
> a good way to learn .
>
> Again thanks for all explanations. Squeak is amazing and so is smalltalk and I feel sad that I was not
> able to discover it a decade earlier and saving myself going through the hassle of learing many programming
> language that I did not end up using seriously except python that I still love very much. I think squeak is a
> perfect fit for my programming philosophy.
>
>
> This body part will be downloaded on demand.



More information about the Beginners mailing list