Re: [Tutor] Modifying Source Code while Program is Running

2005-11-28 Thread Kent Johnson
Ed Singleton wrote: > On 26/11/05, Alan Gauld <[EMAIL PROTECTED]> wrote: >>>I'm sure Python is quite possibly the least worst at this, but that >>>doesn't make it good at it. >> >>Which brings me back to my original question, what environment >>do you think is good at it? Are you aware of such an e

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-27 Thread Alan Gauld
> However, I'm still slightly uncomfortable with it. It smells to me a > bit like the "as long as it works, its fine" school of thought. FRom the client point of view thats true, but from the class designers point of view its very important that the internals be we well designed. And that include

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-26 Thread Danny Yoo
> I had the misfortune a couple of days ago of having to knock up a couple > of web pages in ASP. A very basic search form, results page and details > page. I had to open up a connection to the database, open a recordset, > concatenate a strings to make an SQL query, etc, etc. > > It was horrible

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-26 Thread Alan Gauld
>From this and what Alan said, I think I'm starting to get it. Each > attribute could be an object or an entry in a list. Each type would > be a collection or list of a particular set of attributes. The > collection of types would be an object which is easily persisted. Absolutely! > Can you c

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-26 Thread Ed Singleton
On 26/11/05, Alan Gauld <[EMAIL PROTECTED]> wrote: > >> point. Classes express behaviour, the data is only there to support > >> the behaviour. Thats why methods are polymorphic but not attributes. > > > >If classes express behaviour, then what expresses the structure of the > > data? > > Why do yo

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-26 Thread Alan Gauld
Hi Ed, > Maybe it's just knowing what'll be possible in 10 years time and being > impatient for it. The problem is that over twenty years ago when I was at university the Japanese anounced that they would have launched a 5th generation computer language by 1990. They gave up and we are still wa

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-26 Thread Ed Singleton
On 26/11/05, Kent Johnson <[EMAIL PROTECTED]> wrote: > Ed Singleton wrote: > >>>This immediately seemed to me to be a case for classes. > >>>You provide a way for a user to create a new class by > >>>subclassing the page class (from their point of view > >>>probably through adding a few new fields

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-26 Thread Ed Singleton
On 25/11/05, Alan Gauld <[EMAIL PROTECTED]> wrote: > > Hi Ed, > > This is a longish response because you are raising some > very interesting (and deep) issues from a computer science > point of view. > > > Well, self-modifying isn't inherently necessary. What I guess I > > really need is persisten

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-26 Thread Alan Gauld
>> point. Classes express behaviour, the data is only there to support >> the behaviour. Thats why methods are polymorphic but not attributes. > >If classes express behaviour, then what expresses the structure of the > data? Why do you care? If the program behaves as you expect it what does it

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-26 Thread Kent Johnson
Ed Singleton wrote: >>>This immediately seemed to me to be a case for classes. >>>You provide a way for a user to create a new class by >>>subclassing the page class (from their point of view >>>probably through adding a few new fields to >>>a form). > > The behaviours of all the > classes would b

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-26 Thread Ed Singleton
On 25/11/05, Alan Gauld <[EMAIL PROTECTED]> wrote: > > Just had a quick look at Smalltalk, and at first glance the overview > > of the ideas behind it seems amazing, but the language seems quite > > ugly, and it seems to be very IDE led. > > Adherents will defend its simplicity but I confess I stru

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-25 Thread Kent Johnson
Ed Singleton wrote: > Can a python program change a class, change all the objects already > created by that class and save the modified class definition, so that > if the program were restarted it would return to exactly the same > state? (assuming all objects were saved to a database or somesuch).

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-25 Thread Alan Gauld
Hi Ed,   This is a longish response because you are raising some very interesting (and deep) issues from a computer science point of view.   > Well, self-modifying isn't inherently necessary.  What I guess I> really need is persistent classes as well as persistent objects. Python classes c

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-25 Thread Alan Gauld
> Just had a quick look at Smalltalk, and at first glance the overview > of the ideas behind it seems amazing, but the language seems quite > ugly, and it seems to be very IDE led. Adherents will defend its simplicity but I confess I strugglred for a long time with SmallTalk before learning to lo

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-25 Thread Kent Johnson
Ed Singleton wrote: > Weirdly, I'd just realised that SQLObject does most of what I'm > thinking about. Ahhh. (sigh of relief :-) Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-25 Thread Ed Singleton
On 25/11/05, Ismael Garrido <[EMAIL PROTECTED]> wrote: > Ed Singleton wrote: > > >I want to create a small simple CMS for my website. Users will be > >able to add and edit basic pages. Pages can have sub-pages (no need > >for folders cause a folder and an index.html can be unified into one > >con

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-25 Thread Ismael Garrido
Ed Singleton wrote: >I want to create a small simple CMS for my website. Users will be >able to add and edit basic pages. Pages can have sub-pages (no need >for folders cause a folder and an index.html can be unified into one >concept). > >Users will also be able to create new types of pages, ma

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-25 Thread Kent Johnson
Ed Singleton wrote: > On 24/11/05, Kent Johnson <[EMAIL PROTECTED]> wrote: >> It sounds like maybe you come from a background in Smalltalk, or >> maybe you should look at Smalltalk. In Smalltalk the whole >> environment is dynamic and can be saved and restored easily.> > > Just had a quick look a

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-25 Thread Kent Johnson
Ed Singleton wrote: > I think I can actually achieve this to some degree by doing: > > Class Page(object): > def print(self): > printPage(self) > > And have all my methods call functions (passing on parameters as > necessary). That way if I change a function, it will be changed for

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-25 Thread Ed Singleton
On 24/11/05, Alan Gauld <[EMAIL PROTECTED]> wrote: > There are many ways of doing this, few of them very nice IMHO. > > > without having to restart the program? Is it feasible to get a > > program to change it's own source code while it is running? > > Yes, you can overwrite an existing module the

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-25 Thread Ed Singleton
On 24/11/05, Kent Johnson <[EMAIL PROTECTED]> wrote: > Ed Singleton wrote: > > Is it feasible to change a program's source code whilst it is running > > without having to restart the program? Is it feasible to get a > > program to change it's own source code while it is running? > > You can change

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-24 Thread Alan Gauld
> For example if your program is running, and you make a change to a > class, is it possible to create the necessary class definition and > save it to a file? You can do that but even if you do follow the LSP closely, you still can have problems, especially when you subtract functions or data ra

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-24 Thread Alan Gauld
There are many ways of doing this, few of them very nice IMHO. > without having to restart the program? Is it feasible to get a > program to change it's own source code while it is running? Yes, you can overwrite an existing module then call reload from within the program. > For example, if yo

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-24 Thread Kent Johnson
Ed Singleton wrote: > Is it feasible to change a program's source code whilst it is running > without having to restart the program? Is it feasible to get a > program to change it's own source code while it is running? You can change a class while it is running. > > For example, if you have a we

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-24 Thread Kent Johnson
Ed Singleton wrote: > Hmmm, that's discouraging. Do you know if it's feasible to just keep > changes to code in memory synchronised with changes nto the source > code? So rather than reload source code, make sure that the source > code reflects what is running in memory? > > For example if your

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-24 Thread Ed Singleton
On 24/11/05, Kent Johnson <[EMAIL PROTECTED]> wrote: > Ed Singleton wrote: > > Is it feasible to change a program's source code whilst it is running > > without having to restart the program? Is it feasible to get a > > program to change it's own source code while it is running? > > > > For exampl

Re: [Tutor] Modifying Source Code while Program is Running

2005-11-24 Thread Kent Johnson
Ed Singleton wrote: > Is it feasible to change a program's source code whilst it is running > without having to restart the program? Is it feasible to get a > program to change it's own source code while it is running? > > For example, if you have a web server such as CherryPy that will > (hopefu

[Tutor] Modifying Source Code while Program is Running

2005-11-24 Thread Ed Singleton
Is it feasible to change a program's source code whilst it is running without having to restart the program? Is it feasible to get a program to change it's own source code while it is running? For example, if you have a web server such as CherryPy that will (hopefully) be running for months at a