How to modify the base classes by system browser?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to modify the base classes by system browser?

Li Zhou


Hi Jens
Thank you very much for the message which is guiding me to the right direction to understand the program of lively kernel.
I understand to override by subclassing. What do you mean override methods per instance??? How to change the behavior of base classes. How can I change the code showed on system browser and save it if I want to change core.js.

What do codebase / local button do?
What do Eval On, Load All and Sort do? 

How do I code the event handler (double click on a Morph)?

Thank you very much help me to understand this system.

Li Zhou





Reply | Threaded
Open this post in threaded view
|

Re: How to modify the base classes by system browser?

Robert Krahn
Hi, Li --

Thank you for your interest in Lively. Unfortunately we currently don't have an up-to-date documentation explaining how the tools work so we cannot point you to one specific place to find this information.

The source code of Lively is separated into modules. A module is a set of class, object, and function definitions. Please see this mailing list post for more information about modules and namespaces: http://lists.hpi.uni-potsdam.de/archive/lively-kernel/2010-April/000347.html.

The system code browser allows you to browse and modify the definitions of modules. Since modules are JavaScript files inside of directories the browser allows you to see all the modules inside a specific directory. Example: The core modules of Lively are located in the subdirectory 'lively' of the codebase (the root directory of a Lively installation). For Lively Wiki it is http://lively-kernel.org/repository/lively-wiki/lively/. The codebase button in the browser will open this location. The local code button, on the contrary, will let the browser show the modules of the directory of the current world. The system code browser on this page: http://lively-kernel.org/repository/lively-wiki/users/robertkrahn/browser.xhtml will then show all the modules of http://lively-kernel.org/repository/lively-wiki/users/robertkrahn/.

To browse/edit the modules they get parsed. When you click on a module in the browser parsing starts and a moment later you can see the contents of the module. To parse all modules inside a directory the 'Load All' button can be pressed. This allows you to search code inside modules (again, searching only works for parsed modules). When you enter some source code fragment (like a class name, case sensitive!) somewhere and invoke context menu->text functions->find source, a list appears with class/function/object definitions that include the string you searched for. This way you can locate where the class of an object is implemented.

Modifying a definition inside a module means to change the file of the module and evaluate the change to apply the code change in the running system. If you don't want to change the running system you can press the Eval on/off button to toggle evaluation. You can modifying any definition by typing in new source code and hit CMD+s or in the context menu->text functions press accept changes. Since a file is modified you need an user account for saving the change. You can create one here: http://lively-kernel.org/trac/register.

Sorting does order the module/class/method entries alphabetically.

Objects in Lively can have a class (the constructor attribute of an object points to it) but they can still be changed prototypically. This means that methods/attributes of a specific object can be changed without changing its class. To change the morph menu of a specific morph open a context menu and click inspect. Then evaluate: this.morphMenu = function () { return new MenuMorph([['test', function() { alert('menu entry clicked')} ]], this) }. Then open a context menu again. (This is what Jens means by overriding the behavior in an instance of a class).

Concerning IE9 support: Lively currently does not run on IE9 but we are working on it.
Concerning subworlds: I can open subworlds without a problem, can you please describe the problem?

Best,
Robert



On Oct 14, 2010, at 4:06 PM, Li Zhou wrote:



Hi Jens
Thank you very much for the message which is guiding me to the right direction to understand the program of lively kernel.
I understand to override by subclassing. What do you mean override methods per instance??? How to change the behavior of base classes. How can I change the code showed on system browser and save it if I want to change core.js.

What do codebase / local button do?
What do Eval On, Load All and Sort do? 

How do I code the event handler (double click on a Morph)?

Thank you very much help me to understand this system.

Li Zhou





_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel