Saving a class

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

Saving a class

Mark Carter-4
I'm really new to Smalltalk. I'm running
GNU Smalltalk version 3.0.1
for OS X.

I have manages to create a class Hello:

Object subclass: #Hello
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: ''!


"Create a method"
!Hello methodsFor: 'speaking'!
publish
     Transcript show: 'Greetings. '!

! !

and I can import it using

FileStream fileIn: 'Hello.st' !

But I wondered: suppose I have a class like Hello, and I want to  
export it as a text file. How do I do it?


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

Re: Saving a class

Paolo Bonzini-2
> suppose I have a class like Hello, and I want to export
> it as a text file. How do I do it?

You can load the Parser package

PackageLoader fileInPackage: 'Parser'

and then use something like

(File name: 'Hello.st') writeStream fileOut: Hello; close

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk