[General] Adding source code changes was: lively wiki

Robert Krahn robert.krahn at student.hpi.uni-potsdam.de
Mon Mar 9 22:48:04 CET 2009


Hi, Pete.

> I'm having lots of fun exploring lively  -the experience feels oddly  
> like a game or puzzle   -when i discover something useful in the  
> code i think 'a ha -here is a clue for me')

Yep, we really don't have enough documentation.

> 1. (the meta question) Should I be asking you question 2 below...

If the question might be interesting for other people the mailing list  
is probably the best option.

> 2. (the real question) I can't seem to have changes to a class  
> persist. Specifically...

This is because no changes to object/function/class definitions are  
saved. If you want to change the behavior you have to add a  
redefinition to the world's ChangeSet. E.g. consider that you have:  
TextMorph.doLinkThing = function() { console.log('Link clicked') }.  
Select the source code, open a context menu and go to 'Text  
functions...' and choose 'add as preamble to current ChangeSet'. When  
you save and reload the page the order in which things are loaded is  
the following:

1. LK source code
2. ChangeSet preamble
3. WorldMorph and it's submorphs
4. ChangeSet postscript

This means that things in the preamble are evaluated before morphs are  
deserialized, allowing to add new morph subclasses, and the postscript  
thereafter, letting you manipulate the world.

> nb: i have a page from when i was hacking the clock  -and i note  
> that there is only one class/proto element for each method change
> is there perhaps a problem  -or am i missing something?

You can add any number of class changes, proto changes (methods and  
property, belonging to a class change or being separate), static  
changes (changes to any object), and doit changes (simply some source  
code) as well as one preamble and one postscript element.

> -i found that i was unable to create a js file from the file  
> manager, but have since found that putting js in a 'fake' xhtml file  
> works fine  (but it would be nice if users could have their own .js  
> files sometime)

Right now write permissions are only set for xhtml files but we are  
thinking about changing that.


Robert




More information about the lively-kernel mailing list