Listing the variable names defined in a workspace or REPL session

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Listing the variable names defined in a workspace or REPL session

ZuLuuuuuu
Hello,

How can one list the variable names defined in a workspace or in a REPL session?

For example, after executing these commands on terminal:

 $ gst
 GNU Smalltalk ready

 st> foo := 2
 2
 st> bar := 3
 3

I want to get the variable names 'foo' and 'bar' in a collection or something.

A second question, are there any resources I can learn about such reflecting capabilities of Smalltalk?
Canol Gökel
Reply | Threaded
Open this post in threaded view
|

Re: Listing the variable names defined in a workspace or REPL session

Paolo Bonzini-2
On 03/04/2011 07:54 PM, ZuLuuuuuu wrote:

> How can one list the variable names defined in a workspace or in a REPL
> session?
>
> For example, after executing these commands on terminal:
>
>   $ gst
>   GNU Smalltalk ready
>
>   st>  foo := 2
>   2
>   st>  bar := 3
>   3
>
> I want to get the variable names 'foo' and 'bar' in a collection or
> something.
>

Here is a huge hack:

xyxyxyxy := nil. (#{xyxyxyxy} instVarAt: 3) keys

:)

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Listing the variable names defined in a workspace or REPL session

ZuLuuuuuu
Interesting, thanks :)
Canol Gökel