Warning! Two Newbie questions!

Dwight Hughes dwighth at ipa.net
Mon Apr 17 05:15:59 UTC 2000


giovanni giorgi wrote:
> -----Original Message-----
[......]
> 
> >But I did this in the main MVC-driven screen.  When I did "b :=
> >BankAccount new." I was asked if I wanted to define a new global
> >variable,
> This is another problem, called scope of variables.
> You must use
> ---
> |b|
> b:=BankAccount new.
> ---
> Otherwise Squeak thinks you are trying to define a new GLOBAL variable
> (stored in Smalltalk) and called 'a' and try to help you.
> ----

Um, well, not really -- not if you are working in a Workspace window.
You can define and use local variables (starting with a lowercase
letter) in a Workspace simply by using them -- without explicitly
creating them as temporary variables. Quite handy, since the Workspace
variables hold onto their last value, greatly simplifying interaction
and iterative development.

The problem was most likely created by BankAccount not being created as
a class first - when Squeak first evaluated it, it didn't recognize it
and prompted for how to handle it -- the first choice being to declare
it as a global variable (it being an uppercase identifier).

-- Dwight





More information about the Squeak-dev mailing list