Open Croquet and Cobalt SDK are built on top of the Squeak self-exploratory environment, where everything could be modified/inspected in real time. It means that the environment is just created for live coding and interactive programming in SmallTalk.
Everything is OK, when you use just one computer with only one running vm/image on it (default for Squeak programming model).
But, Croquet/Cobalt were built for creating replicated 3D environments, which are distributed over the network, and several vm's/images running at the same time define the Island.
And so, for saving the identity of replicas of the shared Island, nobody from the participants couldn't change anything in the code in the local images. They are allowed just modify parameters had been programed earlier, or update their images using changeSets, Monticello etc. or just copy/paste the whole image.
But, if we want to program on the Island in all replicas at the same time?
For example it is often needed, when you have already run several images defining Island, but need to modify something in code, without stopping everything.
Or for collaborative coding between several programmers at the same time, forming one image, but working on it's replicas, being at different places.
The feature is missed in the current Croquet SDK (may be XPForums project for collaborative programming using Croquet will solve this, but it is closed yet).
So, as proof of "live coding" concept in Croquet we could do the following:
1. Create the new TObject or TFrame subclass, with instance method like:
Everything is OK, when you use just one computer with only one running vm/image on it (default for Squeak programming model).
But, Croquet/Cobalt were built for creating replicated 3D environments, which are distributed over the network, and several vm's/images running at the same time define the Island.
And so, for saving the identity of replicas of the shared Island, nobody from the participants couldn't change anything in the code in the local images. They are allowed just modify parameters had been programed earlier, or update their images using changeSets, Monticello etc. or just copy/paste the whole image.
But, if we want to program on the Island in all replicas at the same time?
For example it is often needed, when you have already run several images defining Island, but need to modify something in code, without stopping everything.
Or for collaborative coding between several programmers at the same time, forming one image, but working on it's replicas, being at different places.
The feature is missed in the current Croquet SDK (may be XPForums project for collaborative programming using Croquet will solve this, but it is closed yet).
So, as proof of "live coding" concept in Croquet we could do the following:
1. Create the new TObject or TFrame subclass, with instance method like:
TLiveCode>> compileMethod: aCodeString inClass: aClassName
Utilities authorInitialsPerSe isEmpty ifTrue:[ Utilities setAuthorInitials: 'sn'].
aClassName compile: aCodeString.
Utilities authorInitialsPerSe isEmpty ifTrue:[ Utilities setAuthorInitials: 'sn'].
aClassName compile: aCodeString.
2. Add this object into the existed island (or register during initialization):
liveCodeFrame := self harness activeIsland future new: TLiveCode.
liveCodeFrame future registerGlobal: #liveCoding.
liveCodeFrame future registerGlobal: #liveCoding.
3. Then add instance method to the used harness class, like:
CroquetHarness>> makeMethodInFuture: aCodeString inClass: aClassName
| liveCodeFrame|
liveCodeFrame := self activeIsland future at: #liveCode.
liveCodeFrame whenResolved:[
liveCodeFrame futureDo: #compileMethod:inClass: at:0 args: {aCodeString. aClassName}
].
| liveCodeFrame|
liveCodeFrame := self activeIsland future at: #liveCode.
liveCodeFrame whenResolved:[
liveCodeFrame futureDo: #compileMethod:inClass: at:0 args: {aCodeString. aClassName}
].
The calling of this method on any participant will leads to the equal modification of the source code in all connected Island replicas.
This proof of concept code for Croquet/Cobalt image can be downloaded here.
Experimental Seaside based ClassBrowser with support for live coding in Croquet island directly from web-browser is here (the Croquet-Seaside 2.9 imge and above code is needed to run).
Next steps could be the development of corresponding tools using existed SystemBrowser or OmniBrowser for full support of live coding/collaborative programming in the shared Islands.