List Info

Thread: How does one fileout a class. Also is there a shell command call




How does one fileout a class. Also is there a shell command call
user name
2007-08-28 05:50:09
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


_______________________________________________
help-smalltalk mailing list
help-smalltalkgnu.org

http://lists.gnu.org/mailman/listinfo/help-smalltalk

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )