[squeak-dev] How to create a 'Hello world' example for environments
Chris Cunnington
brasspen at gmail.com
Sun Oct 2 22:07:57 UTC 2016
I not sure if I've gone off the rails here, but it keeps working for me.
Chris
"acquire a Squeak6.0alpha and create an Environment"
env := Environment withName: 'WbSrvr'.
env importSelf.
"load WebClient-Core into Environment"
chunkcode := ReadWriteStream on: (String new: 1000).
SystemOrganizer default fileOutCategory: 'WebClient-Core' on: chunkcode
initializing: true.
chunkcode reset.
env fileIn: chunkcode announcing: 'Load Environment'.
"start WebServer in environment"
Compiler evaluate: 'WebServer exampleBrowse' environment: env.
"go to WebServer class>exampleBrowse in a Browser and change port to
8888, then start"
WebServer exampleBrowse
"open tabs in"
http://localhost:9999
http://localhost:8888
"to see the port in the Environment is still 9999"
env explore.
"highlight WebServer in #declarations and explore"
self class methodDictionary
"toggle #exampleBrowse and see the port is 9999"
"for added fun, go to Process class>>#forContext:priority: and add"
newProcess env: Environment current.
"start again from the top, this time, explore the WebServer processes in
ProcessBrowser to see both Environments are Smalltalk. I have no idea
what that means. I would have thought the WebServer instance started
with WbSrvr environment would be in a WbSrvr process."
More information about the Squeak-dev
mailing list
|