ChanHong Kim wrote:
> Hi, all.
>
> I'm writing the Dolphin Smalltalk tutorial in Korean.So I'll explain
> [variables] in philosopical method.
>
> In Smalltalk, "Everything is Object", however, variable is not.
> I can't send any message variable itself. The message sent to the
> object which is bind that variable.
>
> How can I explain such situation? Please tell me good idea about
> explain the concept of Smalltalk's variables.
>
> Have a nice day.
Ok, the philosophical method.
Smalltalk consists of 2 layers:
1. The objects system.
Simply everything is an object. All is based on sending messages to
objects. There's nothing else.
2. The language.
The Smalltalk language is simply a macro language, or meta language. It
provides an easy to use way to work with objects and send messages to
them. Variables and the "assignment operator" := are simply syntax sugar.
All global variables are simply entries in the global dictionary named
Smalltalk. You can directly work with this dictionary to work with
global variables.
Something the same is with local variables, especially workspace
variables. The implementation of the "macro languages" differs here from
implementation to implementation. In Dolphin Smalltalk, workspace
variables are local to the workspace where they were created. In
Smalltalk/X on the other hand, all workspace variables are shared
between all workspaces.
Take a look at the documentation of Gnu Smalltalk. There's included a
nice tutorial, where you can directly discover this behaviar of "syntax
sugar" and how variables work.
Have a nice day,
Yogi