Webserver in Self
russell.allen23
mail at russell-allen.com
Sun May 18 08:55:21 UTC 2008
Hi everyone,
Thanks for your help.
I hacked up a small and extremely simple webserver based on the socketServer code. The
transporter code goes in applications/. I'm not sure if I can attach it to an email so I've put
it up on the web at: http://russell-allen.com/self/downloads/files/webserver.self
File in with: bootstrap read: 'webserver' From: 'applications'
Setup default with: webserver registerServlet: (webserver exampleServlets fileServlet copy)
At: ''.
Start with: webserver start
Go to: http://localhost:8080/
I'd appreciate it if anyone has a change to try to file it in and possibly comment on how
'selfish' it is in style.
Some notes and comments I made while writing it:
- although I worked out how to write out a module from the materials, I had more trouble
reading it in again. I eventually found a note on Jecel's site with the magic incantation
(bootstrap read: 'webserver' From: 'applications'); I couldn't find a suitable way to do it
from morphic.
- I was pleasantly suprised how nice Self morphic was for *writing* code (the word isn't
quite right - it felt more like construction than writing)
- On the other hand, the inspectors were hard to *read* code with. My continual question
was "What methods does a string understand anyway?" and "How do I open a file?"; it was
hard to answer this without opening millions of inspectors all over my nice nebraskan
plain (plane?).
- I kept on writing stuff like "method: a = (|| a print )" and getting an error because I
needed a space between the bars.
- syntax differences from Smalltalk I haven't yet internalised: the use of capital letters in
message names, block notation; I kept writing: "[:k | k print]", slots between the bars; I
kept writing "| var1 var2 | code"
- it was most frustrating that the inspectors for arrays/lists/dictionaries showed the
normal slots and not a more useful view of what was actually in the collection
Cheers,
Russell
PS: I've just noticed that the Transporter has declared my code to be (c) Sun and Stanford,
which it obviously isn't. Is there a way to change this?
More information about the Self-interest
mailing list