Parser

Lukas Renggli renggli at iam.unibe.ch
Wed Aug 4 13:15:39 MEST 2004



> there is something strange about smallwiki and the visitor. When a 
> visitor
> visit a collection, it has a code like :
>
>  visitCollection: aCollection
> 	aCollection
> 		do: [ :child | child accept: self ]
>
> shouldn t we have something like
>
> visitCollection: aCollection
> 	aCollection
> 		do: [ :child | self visit: child ]

both implementations are actually the same, because #visit: looks like 
this:

	Visitor>>#visit: anObject
		anObject accept: self.

But you are right, the names of the messages in the visitor 
implementation of SmallWiki 1 are somehow strange and confusing. This 
will be improved in SmallWiki 2. Have a look  at past posts in the 
SmallWiki mailing-list that discuss that issue.

> because I want, for example, to evaluate a code each time a wikiItem 
> is visited. So it should be placed in the method visit: but then, in 
> that situation, wikiItems contained in a collection doesnt launch the 
> method
> visit, but instead launch directly the method accept.
> what do you think of it ?

Most of the time this isn't necessary: you could put an inst-var into 
your visitor class, remembering the parent of your links.

Hope this helps,
Lukas

-- 
Lukas Renggli
http://renggli.freezope.org




More information about the SmallWiki mailing list