[Q] Network IM and Jabber

Avi Bryant avi at beta4.com
Fri Apr 4 07:24:07 UTC 2003

On Thu, 3 Apr 2003, Brian Brown wrote:

> openOn: anXMLWriter
> 	| elementDTD dtd |
> 	self xmlWriter: anXMLWriter.
> 	dtd _ self class dtd.
> 	elementDTD _ dtd elementDeclaration: self dtdName.
> 	anXMLWriter dtd: dtd.
> 	elementDTD marshalStart: self on: anXMLWriter.
> 	anXMLWriter stream flush
> It's having a problem with the: dtd _ self class dtd.
> self is a JabberStream which has no method #class, so is that a (gulp) keyword?
> Or is it a method of Object?

It is indeed a method of Object.  You can find this out using the
"implementors of" feature: select the word "class" and hit cmd-m.  If you
have "optional buttons" enabled, there should also be an "impl" button in
your browser that will show you a menu with selectors to choose from.
Either way, you'll get a list of the implementations of #class - in this
case, only Object.

The dirty truth about this particular message is that it never actually
gets sent - it's one of the handful that are essentially inlined by the
compiler.  But that doesn't (usually) change its semantics.

> I find no class named dtd, no instance vars or
> class vars, only the local var declared in this method.

Well, "self class dtd" is a method call, not a reference to a class,
inst var, or class var.  It's sending the #dtd message to the result of
sending the #class message to self - in other words, get the current
instance's class and send #dtd to it.  Having an instance call a class
side method like this is a fairly common pattern.

Again, the most natural step here is to ask for the implementors of #dtd.
What I found is that it's only implemented by XMLDocument, which is not a
superclass of JabberStream - not surprising, since we knew from the MNU
that the method didn't exist.  Switching over to the class side of
JabberStream shows a couple of DTD related methods - maybe the method for
actually returning a DTD object got lost somehow?

At any rate, it definitely looks to me like the code is somehow
incomplete.  It also looks like it may be written against a different
version of YAXO from the current one - for example,
JabberProtocolEntity>>registerDTDs refers to the DTDDeclaration class,
which doesn't seem to exist anymore.


More information about the Squeak-dev mailing list