help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] How does one fileout a class. Also is there a shell com


From: Stephen
Subject: [Help-smalltalk] How does one fileout a class. Also is there a shell command call
Date: Tue, 28 Aug 2007 22:50:09 +1200
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)

Hi all,

I'm getting into smalltalk and have a some newbie questions I'm hoping someone can answer:

Here are the questions.. see below for more detail on each question :-
  1. How does one fileout code in a human readable form?
  2. How do I print a list of all the classes in the system?
3. How does one call an operating system shell command and get the output?

Background: I'd like to use GNU Smalltalk for some Linux operating system scripting and so am running GST headless.

1. Fileout code
I've tried the following...

st> Account class fileOutOn: stdout !

-------------------------------------------
"Filed out from GNU Smalltalk version 2.3.3 on 28-Aug-2007  14:45:32"!

Object subclass: #Account
      instanceVariableNames: 'balance naming '
      classVariableNames: ''
      poolDictionaries: ''
      category: nil!

Account comment:
'I represent a place to deposit and withdraw money'!

!Account class methodsFor: 'instance creation'!

 ! !
! !

!Account methodsFor: 'instance initialization'!

 ! !
! !

!Account methodsFor: 'moving money'!

 ! !
!

 !
! !

Code is in fact there, for instance...
st> a deposit: 20!
Account new "<-0x4c65dc70>"
st> a printOn: stdout !
an Account with balance: 175Account new "<-0x4c65dc70>"
---------------------------------------------

As you can see, the code isn't being printed. What would be the command to print the method code in the Account class?


Secondly, I'm thinking that if I have some scripting classes in an image, I'll prefix all my classes with a standard prefix and then I can easily see which are my classes. But how does one print out the list of all the classes in an image... or for instance, print out all the classes in an image starting with say SO?

Thirdly, is there a way to make an operating system shell call and retrieve the output of the call. For instance is it possible to submit "ls -l /etc" to the operating system and to get the output of this command?

Many thanks
Stephen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]