When I define a message smalltalkDoc in the class "Class" it does not have problems there. But when I try to define a subclass "SmalltalkDoc" of "Class" and put the message smalltalkDoc in this class, by evaluating for example the expression "LinkedList smalltalkDoc." I have a message context : "LinkedList class(Object)>>doesNotUnderstand: #smalltalkDoc." How can I fix this? here the message. smalltalkDoc    "Genere un fichier HTML avec les Informations d'une classe" |stream nom| nom:=self asString,'SmalltalkDoc.html'. stream := FileStream forceNewFileNamed: nom. stream nextPutAll: '<html> <head> <title>A little Smalltalk Doc</title> </head> <body> '; nextPutAll: '</p>'; nextPutAll: 'class name : '; nextPutAll: self name asString; nextPutAll: '</p>'; nextPutAll: '<p></p>'; nextPutAll: 'superclass name : '; nextPutAll: self superclass name asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'trait Composition : '; nextPutAll: self traitCompositionString asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'class trait Composition : '; nextPutAll: self class traitCompositionString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'category : ' ; nextPutAll: self category asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'instances Variable Names : '; nextPutAll: self instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'pool Dictionary Names : '; nextPutAll: self poolDictionaryNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class instances Variable Names : '; nextPutAll: self class instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'type of class : '; nextPutAll: self typeOfClass asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Comment : '; nextPutAll: self organization classComment asString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'comment Stamp : '   ; nextPutAll: self organization commentStamp asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Variables Names : '; nextPutAll: self classVarNames asString ; nextPutAll: '<p>'; nextPutAll: 'selectors : '; nextPutAll: self class selectors asString ; nextPutAll: '</p>'; nextPutAll: '</p>'; nextPutAll: '</body> </html>'. stream close.  ------------------------------------ Hayatou Â
I'm afraid I can't help much but if you define a method for the Stream object you can have a shorter code, avoiding all these "<p>" everywhere. Something like paragraphe: unString self nextPutAll: '<p>'. self nextPutAll: unString. self nextPutAll: '</p>'. Afterwards you would just list things like paragraphe: 'class name : ',self name asString; so that one entry would take one line of code instead of four. But maybe I am violating some principles for good programming? And it doesn't show why SmalltalkDoc is not understood by your class... On Tue, Feb 12, 2013 at 4:25 AM, Hayatou Oumarou <hayaty55@yahoo.fr> wrote:
When I define a message smalltalkDoc in the class "Class" it does not have problems there. But when I try to define a subclass "SmalltalkDoc" of "Class" and put the message smalltalkDoc in this class, by evaluating for example the expression "LinkedList smalltalkDoc." I have a message context : "LinkedList class(Object)>>doesNotUnderstand: #smalltalkDoc."
How can I fix this?
here the message.
smalltalkDoc "Genere un fichier HTML avec les Informations d'une classe" |stream nom| nom:=self asString,'SmalltalkDoc.html'. stream := FileStream forceNewFileNamed: nom. stream nextPutAll: '<html> <head> <title>A little Smalltalk Doc</title> </head> <body> '; nextPutAll: '</p>'; nextPutAll: 'class name : '; nextPutAll: self name asString; nextPutAll: '</p>'; nextPutAll: '<p></p>'; nextPutAll: 'superclass name : '; nextPutAll: self superclass name asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'trait Composition : '; nextPutAll: self traitCompositionString asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'class trait Composition : '; nextPutAll: self class traitCompositionString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'category : ' ; nextPutAll: self category asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'instances Variable Names : '; nextPutAll: self instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'pool Dictionary Names : '; nextPutAll: self poolDictionaryNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class instances Variable Names : '; nextPutAll: self class instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'type of class : '; nextPutAll: self typeOfClass asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Comment : '; nextPutAll: self organization classComment asString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'comment Stamp : ' ; nextPutAll: self organization commentStamp asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Variables Names : '; nextPutAll: self classVarNames asString ; nextPutAll: '<p>'; nextPutAll: 'selectors : '; nextPutAll: self class selectors asString ; nextPutAll: '</p>'; nextPutAll: '</p>'; nextPutAll: '</body> </html>'. stream close.
------------------------------------ Hayatou
On Feb 12, 2013, at 10:21 AM, Alain Busser <alain.busser@gmail.com> wrote:
I'm afraid I can't help much but if you define a method for the Stream object you can have a shorter code, avoiding all these "<p>" everywhere.
Something like
paragraphe: unString self nextPutAll: '<p>'. self nextPutAll: unString. self nextPutAll: '</p>'.
Afterwards you would just list things like paragraphe: 'class name : ',self name asString; so that one entry would take one line of code instead of four.
But maybe I am violating some principles for good programming?
Now this is indeed much nicer :)
And it doesn't show why SmalltalkDoc is not understood by your class...
On Tue, Feb 12, 2013 at 4:25 AM, Hayatou Oumarou <hayaty55@yahoo.fr> wrote: When I define a message smalltalkDoc in the class "Class" it does not have problems there. But when I try to define a subclass "SmalltalkDoc" of "Class" and put the message smalltalkDoc in this class, by evaluating for example the expression "LinkedList smalltalkDoc." I have a message context : "LinkedList class(Object)>>doesNotUnderstand: #smalltalkDoc."
How can I fix this?
here the message.
smalltalkDoc "Genere un fichier HTML avec les Informations d'une classe" |stream nom| nom:=self asString,'SmalltalkDoc.html'. stream := FileStream forceNewFileNamed: nom. stream nextPutAll: '<html> <head> <title>A little Smalltalk Doc</title> </head> <body> '; nextPutAll: '</p>'; nextPutAll: 'class name : '; nextPutAll: self name asString; nextPutAll: '</p>'; nextPutAll: '<p></p>'; nextPutAll: 'superclass name : '; nextPutAll: self superclass name asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'trait Composition : '; nextPutAll: self traitCompositionString asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'class trait Composition : '; nextPutAll: self class traitCompositionString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'category : ' ; nextPutAll: self category asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'instances Variable Names : '; nextPutAll: self instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'pool Dictionary Names : '; nextPutAll: self poolDictionaryNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class instances Variable Names : '; nextPutAll: self class instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'type of class : '; nextPutAll: self typeOfClass asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Comment : '; nextPutAll: self organization classComment asString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'comment Stamp : ' ; nextPutAll: self organization commentStamp asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Variables Names : '; nextPutAll: self classVarNames asString ; nextPutAll: '<p>'; nextPutAll: 'selectors : '; nextPutAll: self class selectors asString ; nextPutAll: '</p>'; nextPutAll: '</p>'; nextPutAll: '</body> </html>'. stream close.
------------------------------------ Hayatou
On Feb 12, 2013, at 1:25 AM, Hayatou Oumarou <hayaty55@yahoo.fr> wrote:
When I define a message smalltalkDoc in the class "Class" it does not have problems there. But when I try to define a subclass "SmalltalkDoc" of "Class"
Why SmalltalkDoc would be a subclass of Class? It should inherit from Object then you can define a message in Class>>smalltalkDoc (not really good style) ^ SmalltalkDoc on: self This way you can execute LinkedList smalltalkDoc and then send the message to build the doc to the smalltalkdoc object. Stef
and put the message smalltalkDoc in this class, by evaluating for example the expression "LinkedList smalltalkDoc." I have a message context : "LinkedList class(Object)>>doesNotUnderstand: #smalltalkDoc."
How can I fix this?
here the message.
smalltalkDoc "Genere un fichier HTML avec les Informations d'une classe" |stream nom| nom:=self asString,'SmalltalkDoc.html'. stream := FileStream forceNewFileNamed: nom. stream nextPutAll: '<html> <head> <title>A little Smalltalk Doc</title> </head> <body> '; nextPutAll: '</p>'; nextPutAll: 'class name : '; nextPutAll: self name asString; nextPutAll: '</p>'; nextPutAll: '<p></p>'; nextPutAll: 'superclass name : '; nextPutAll: self superclass name asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'trait Composition : '; nextPutAll: self traitCompositionString asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'class trait Composition : '; nextPutAll: self class traitCompositionString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'category : ' ; nextPutAll: self category asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'instances Variable Names : '; nextPutAll: self instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'pool Dictionary Names : '; nextPutAll: self poolDictionaryNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class instances Variable Names : '; nextPutAll: self class instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'type of class : '; nextPutAll: self typeOfClass asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Comment : '; nextPutAll: self organization classComment asString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'comment Stamp : ' ; nextPutAll: self organization commentStamp asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Variables Names : '; nextPutAll: self classVarNames asString ; nextPutAll: '<p>'; nextPutAll: 'selectors : '; nextPutAll: self class selectors asString ; nextPutAll: '</p>'; nextPutAll: '</p>'; nextPutAll: '</body> </html>'. stream close.
------------------------------------ Hayatou
 Hello I do not want to write new messages in an existing class, more precisely I project to create a category with only my own classes for my project in SmalltalkHub.  Cordially. ------------------------------------ Hayatou  - De : stephane ducasse <stephane.ducasse@free.fr>  Hayatou Oumarou wrote: When I define a message smalltalkDoc in the class "Class" it does not have problems there. But when I try to define a subclass "SmalltalkDoc" of "Class" Why SmalltalkDoc would be a subclass of Class? It should inherit from Object then you can define a message in Class>>smalltalkDoc (not really good style) ^ SmalltalkDoc on: self This way you can execute LinkedList smalltalkDoc and then send the message to build the doc to the smalltalkdoc object. Stef and put the message smalltalkDoc in this class, by evaluating for example the expression "LinkedList smalltalkDoc." I have a message context :
"LinkedList class(Object)>>doesNotUnderstand: #smalltalkDoc."
How can I fix this?Â
here the message.
smalltalkDoc    "Genere un fichier HTML avec les Informations d'une classe" |stream nom| nom:=self asString,'SmalltalkDoc.html'. stream := FileStream forceNewFileNamed: nom. stream nextPutAll: '<html> <head> <title>A little Smalltalk Doc</title> </head> <body> '; nextPutAll: '</p>'; nextPutAll: 'class name : '; nextPutAll: self name asString; nextPutAll: '</p>'; nextPutAll: '<p></p>'; nextPutAll: 'superclass name : '; nextPutAll: self superclass name asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'trait Composition : '; nextPutAll: self traitCompositionString asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'class trait Composition : '; nextPutAll: self class traitCompositionString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'category : ' ; nextPutAll: self category asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'instances Variable Names : '; nextPutAll: self instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'pool Dictionary Names : '; nextPutAll: self poolDictionaryNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class instances Variable Names : '; nextPutAll: self class instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'type of class : '; nextPutAll: self typeOfClass asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Comment : '; nextPutAll: self organization classComment asString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'comment Stamp : '   ; nextPutAll: self organization commentStamp asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Variables Names : '; nextPutAll: self classVarNames asString ; nextPutAll: '<p>'; nextPutAll: 'selectors : '; nextPutAll: self class selectors asString ; nextPutAll: '</p>'; nextPutAll: '</p>'; nextPutAll: '</body> </html>'. stream close.
Â
------------------------------------ Hayatou Â
On Feb 13, 2013, at 12:02 AM, Hayatou Oumarou <hayaty55@yahoo.fr> wrote:
Hello I do not want to write new messages in an existing class, more precisely I project to create a category with only my own classes for my project in SmalltalkHub.
You define a category and put SmaltalkDoc in there and in a category starting with a *yourpackage you put in the class Class the method smalltalkDoc => this way you can group all your code. read the monticello chapter
Cordially.
------------------------------------ Hayatou - De : stephane ducasse <stephane.ducasse@free.fr>
Hayatou Oumarou wrote:
When I define a message smalltalkDoc in the class "Class" it does not have problems there. But when I try to define a subclass "SmalltalkDoc" of "Class"
Why SmalltalkDoc would be a subclass of Class? It should inherit from Object
then you can define a message in
Class>>smalltalkDoc (not really good style) ^ SmalltalkDoc on: self
This way you can execute
LinkedList smalltalkDoc and then send the message to build the doc to the smalltalkdoc object.
Stef
and put the message smalltalkDoc in this class, by evaluating for example the expression "LinkedList smalltalkDoc." I have a message context : "LinkedList class(Object)>>doesNotUnderstand: #smalltalkDoc."
How can I fix this?
here the message.
smalltalkDoc "Genere un fichier HTML avec les Informations d'une classe" |stream nom| nom:=self asString,'SmalltalkDoc.html'. stream := FileStream forceNewFileNamed: nom. stream nextPutAll: '<html> <head> <title>A little Smalltalk Doc</title> </head> <body> '; nextPutAll: '</p>'; nextPutAll: 'class name : '; nextPutAll: self name asString; nextPutAll: '</p>'; nextPutAll: '<p></p>'; nextPutAll: 'superclass name : '; nextPutAll: self superclass name asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'trait Composition : '; nextPutAll: self traitCompositionString asString; nextPutAll: '<p></p>'; nextPutAll: '<p></p>'; nextPutAll: 'class trait Composition : '; nextPutAll: self class traitCompositionString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'category : ' ; nextPutAll: self category asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'instances Variable Names : '; nextPutAll: self instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'pool Dictionary Names : '; nextPutAll: self poolDictionaryNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class instances Variable Names : '; nextPutAll: self class instVarNames asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'type of class : '; nextPutAll: self typeOfClass asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Comment : '; nextPutAll: self organization classComment asString asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'comment Stamp : ' ; nextPutAll: self organization commentStamp asString; nextPutAll: '</p>'; nextPutAll: '<p>'; nextPutAll: 'class Variables Names : '; nextPutAll: self classVarNames asString ; nextPutAll: '<p>'; nextPutAll: 'selectors : '; nextPutAll: self class selectors asString ; nextPutAll: '</p>'; nextPutAll: '</p>'; nextPutAll: '</body> </html>'. stream close.
------------------------------------ Hayatou
participants (3)
-
Alain Busser -
Hayatou Oumarou -
stephane ducasse