Re: Re: Load and save commands for interpeter

Paul Prescod <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
Mark Hahn wrote:

> Paul Prescod wrote:
> 
>>I just had an idea that it would be cool if the Prothon command line
>>had commands to load and save scripts. When you "save" it would turn
>>your transcript into a valid Prothon program that you could run again
>>or edit and run.
> 
> 
>  The history of what has happened in your session is already in a file you
> can open and edit to turn into a script. 

Neat.

> ... The file is in the same folder as
> prothon.exe and is called ".prothon_history".  Have you ever noticed that
> the command history was remembered between sessions?

Actually the command line doesn't seem to work on Mac OS X. I didn't 
complain because I know you guys have higher priorities...

But I would just say that putting it with "prothon.exe" is a bad idea. 
What about multiuser systems?

Luckily it doesn't look to me like the code does that:

if ((home = getenv("HOME")) != NULL)
     apr_snprintf(histfile, sizeof(histfile),
             "%s/%s", home, PROTHON_HISTORY);

Some day it should use Windows APIs to find the user's home directory 
(on Windows).

>...
> I have considered this before.  I've considered it in two contexts.  The
> console as you suggest and as the core of an interactive IDE.
 >
> The reason I didn't do it in the console is that the idea quickly mushroomed
> into a real shell.  At that point I realized there was no reason not to drop
> out into the real shell.

You can't really deal with load and save by dropping into the real shell.

> The interactive IDE is going to happen in the future.
> 
> 
>>In general it would be cool if the command line had extra functions
>>like "run" which would run a command in the operating system shell.
>>Maybe with string interpolation...
> 
> 
> O>> import os

That's good enough I suppose.

  Paul Prescod
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.