[lively-kernel] Contributing source code to the Lively Kernel

Adam Spitz adam.spitz at gmail.com
Thu Apr 15 21:33:36 CEST 2010


Thanks! Your explanation helps a lot.

For a while now, I've been meaning to put up a screencast
demonstrating how my Self-like LK development environment handles this
kind of stuff. I'll try to get around to it soon. :)


On Wed, Apr 14, 2010 at 6:25 PM, Robert Krahn
<robert.krahn at student.hpi.uni-potsdam.de> wrote:
> Hi, Adam --
> Thanks for trying it out!
> I can understand your confusion very well. I think that the problems that
> occur now are very valuable for us because we can learn from them and know
> what we have to improve, to communicate, and to document. I encourage you
> and everybody else to send your experiences and suggestions to the list so
> we can find solutions for them.
> Jens, Dan, and I are working in the system for some time now and we have our
> ways of doing things -- but these are necessarily not the best solutions and
> discussions about improvements are very welcome. The system already is
> capable of quite a lot but often it might not be obvious of how to approach
> a certain task (like creating and editing a file).
> Background info:
> Development in Lively was completely file-based in the beginning. This means
> that the way of writing code was to edit a JavaScript file, start the
> system, see if the change worked, add another change, restart, and so on.
> We then added support for editing the files from within Lively. This way it
> was not necessary anymore to restart the system. The tool that we use for
> that is the 'System code browser'.
> Next thing we did was to attach 'changes' to a world. A change is some
> JavaScript code snippet like a class definition that can be evaluated on
> world load. Changes aren't stored in a JavaScript file but are currently
> added to the XHTML data of a world. To edit them we use the 'Local code
> browser' and the 'Wiki code browser' (to edit changes of other worlds and
> not only the current one).
> Sooner or later we might want to abandon files completely  but currently the
> mixture of files and local changes provides a lot of flexibility: If the
> system is broken for some reason or doesn't have support for something you
> want to do you can simply use other tools.
> The way I prefer to develop is the following:
> - I start to add tests and code to a world as local changes using the 'Local
> code browser. For code snippets I want to try out I use a text window
> (similar to a Smalltalk workspace).
> - When I'm done I merge/push my changes to some module. Currently this is
> done manually using copy and paste.
> - If I want to add it to an existing module I open the System browser and
> edit it.
> - If I want to create a new module I can do it with the System browser using
> 'add module' button. If you want to edit files in another directory as the
> default then you can choose 'Switch System browser directory' in the tools
> menu. This part is still to complicated and we will improve it soon.
> To get an impression of how I develop such a
> world: www.lively-kernel.org/repository/webwerkstatt/!svn/bc/5120/robert/DraftXMLConverter.xhtml.
> You can also view at the different versions to see the development process.
> Ah, and don't worry about changes to the core system. It is always possible
> to find out what was changed (using SVN or the 'Viewer for latest file
> changes') and additionally the wiki is separated from the kernel repository.
> We are able to sync them but currently do this
> semi-automatically: www.lively-kernel.org/repository/webwerkstatt/update.xhtml.
> I hope I was able to clear up your confusion at least a bit.
> Best,
> Robert
> On Apr 14, 2010, at 5:19 PM, Adam Spitz wrote:
> Robert Krahn wrote:
> Part 2: Using modules to add your extensions
> The first thing you need is some place to store your source code and your
> data. You can create your own subdirectory in the wiki
> here: http://www.lively-kernel.org/repository/lively-wiki/CreateUserDirectory.xhtml
> Your directory includes a WorldTemplate.xhtml that you can clone to create
> new pages. You can then add new Worlds and add source code in them using the
> local changes (and the Local code Browser, you find it in the Tools menu).
> Or you can create your own JavaScript files using the System browser or
> manually by checking out your directory using SVN and adding/editing files
> with a TextEditor. The JavaScript files should include a module definition.
> I'm confused about all these different tools.
> The System Code Browser (which I originally thought would be like a
> Smalltalk browser, showing me what's in the live image) seems to be
> showing me what's in the system code *files*. When I first open it up,
> it says that everything, even the core stuff (Core.js, Text.js, etc.),
> is "not loaded." Then when I click on the file name, it "loads", which
> I take to mean that the system is parsing the file and showing me
> what's in it (rather than showing me the actual code that's in the
> live image). If I make a change in there and hit Apple-S, it saves the
> change, and that change is visible if I hit my browser's Reload button
> or even open the world in another browser. So it obviously saved my
> change to a file somewhere. Where's the file? The only file in
> http://www.lively-kernel.org/repository/lively-wiki/users/AdamSpitz/
> is the WorldTemplate.xhtml file (I don't see any .js files there), so
> I hope I didn't just overwrite some important official LK file or
> something.
> And then there's the Javascript Code Browser, which I can open by
> right-clicking any morph and saying "show class in browser." If I make
> a change *there*, it seems to be only changing the running image -
> when I reload the page my change is gone. Good, that makes sense to
> me.
> Incidentally, I noticed that after I've opened a System Code Browser,
> the Javascript Code Browser doesn't seem to work anymore - I get an
> error message in the console saying, "TypeError: Result of expression
> 'this.methodDicts' [undefined] is not an object." (Did I just cause
> this error by mucking around with system files?)
> Is the System Code Browser just meant to be a way of editing .js
> files? (That is, it doesn't operate on the live image, it's just a bit
> nicer than Emacs for editing .js files?) Is the idea that most
> "normal" programming (programming that isn't likely to crash the whole
> system if you make a typo) should be done in the Javascript Code
> Browser?
> ** Using the namespace inside a module is NOT enforced. This means if you
> define a class Object.subclass('SystemBrowser', {...}) it will "extend" the
> Global namespace. This means that you can access the class via
> Global.SystemBrowser (or simply with SystemBrowser). Only if you use the
> namespace explicitly Object.subclass('lively.ide.SystemBrowser', {...}) the
> namespace will be used and you can access the class via
> Global.lively.ide.SystemBrowser (or simply lively.ide.SystemBrowser).
> We might change that in the future to enforce namespace usage.
> If you do that, will it still be possible for me to write, say, a
> "set" class and add an asSet method to the Array class?
> Come to think of it, how does the current system know how to find
> "extension" methods like that and file them out when you file out the
> module that they belong to? In Self's module system (and in my port of
> it to LK), the module object itself keeps track of all the slots
> belonging to the module. But I don't think I've seen anything like
> that in LK. (I could easily have missed it, though.)
> Adam
> _______________________________________________
> lively-kernel mailing list
> lively-kernel at hpi.uni-potsdam.de
> http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel

More information about the lively-kernel mailing list