[self-interest] Re: Webserver in Self

Jecel Assumpcao Jr jecel at merlintec.com
Mon May 19 23:28:03 UTC 2008


Russell,

> 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 

I don't think an attachment would have been a problem, but Yahoo
probably wouldn't have saved it in the archives (at least not for very
long) and that can be frustrating to people who later find these
messages.

> 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.

Your use of C-like variable names (one letter) is certainly very Selfish
:-)

I didn't try to code, but it looks good. The only think I thought a bit
strange was your use of 'deadCopy' for creating new files and sockets.
But that might be the proper way to do it. Your use of a privacy
"parent" is a very good idea.

> - 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.

It used to be easier. Before the transporter we just called _RunScript
(or something like that) directly on the string with the file name. Now
that we have the transporter it would be a good idea to have some kind
of GUI. That would probably be something like the File Browser in
Smalltalk.

> - 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?).

There are some search tools but they are harder to use at first than
senders/implementors in Smalltalk. Searching manually through all the
parents takes up a lot of screen space, as you said, but at least it is
easy to do.

> - I kept on writing stuff like "method: a = (|| a print )" and getting an error because I 
> needed a space between the bars.

That, and the various uses of ".", would be nice to fix.

> - 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"

When I wrote my first real application in Self 4.0, I didn't notice that
the snapshot I was using included Mario's Smalltalk stuff. So I kept
writting ifTrue:False: instead of ifTrue:IfFalse: but it worked! When I
moved the code to a newer Self all these Smalltalkisms broke down and I
had to rewrite it.

> - 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

For small lists you can look at their name to quickly see what is in
them. Dictionaries are the worst case, specially since they are based on
parallel arrays instead of sets of associations like in Smalltalk. So
noting which value goes with which key can be complicated.

> 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?

It should be easy to fix this. The transporter sends the 'copyright'
message to the module it is saving and normally all modules have that
data slot set to the string you noticed by virtual of being clone of the
init module. So you might want to inspect your module object and edit
its string.

-- Jecel



More information about the Self-interest mailing list