What would be extremely useful (to me at least) is to provide example usage for some of the more cryptic and difficult classes. The person writing them has the best understanding and probably had to test things out anyway. So why not just publish that code in the class comment? For example...
I've been struggling for 2 days trying to get a TCP client socket dialog with a telnet server. In VisualWorks, I would do something like:
wire := ( SocketAccessor newTCPclientToHost: 'telnetHostname' port: 23 ) readAppendStream.
I can then use:
wire throughAll
and
wire nextPutAll:
among other stream methods, to handle the communication.
I do notice the SocketStream has a HTTP example, but I don't think SocketStream is for TCP (I could be wrong, but there is no documentation either way).
I haven't figured it out yet in Squeak. I thought I could do something like this:
wire := SocketStream openConnectionToHostNamed: 'telnetHostname' port: 23.
and then use
wire upToAll:
and
wire nextPutAll:
but this just 'hangs' and I have to alt+. to abandon the process.
Is this even possible in Squeak? Or do I have to load something else into the image?
Sockets are very hard to debug and I don't want to have to use the Socket class. That is way too low level for me. The purpose of Smalltalk is to make things easy, no? ;-)
Daniel Klein
"You do not really understand something
unless you can explain it to your grandmother."
-- Albert Einstein.