[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Image based development

Blake McBride

8/28/2015 5:03:00 PM


A popular development scenario that I term "disk based" looks like the
following:

A. A program is created / edited with a text editor (like emacs)

B. The code is saved to a disk file (like myprogram.lisp )

C. A language interpreter / compiler loads (from disk or a socket)
and runs the code where the programmer evaluates its performance

D. Go back to A.

---

There is another development scenario that is old, but may be worth
looking into. I term this other method "image based" and it looks like
the following:

1. Code is added and edited right in the environment where it is being
used (like CCL, SBCL, CLISP, etc.). Editing the code could be done
with an editor like a structure editor written in Lisp rather than a
text editor.

2. Run the code right in the environment it was created in.

3. Go to step 1 in order to continue development.

Also:

4. The state of the project can be saved as an image file
representing the entire project when necessary (i.e. CLISP .mem file,
SBCL and CMUCL .core file, CCL image file, etc.).

5. A disk / text form of the application can also be created for
reference or porting whenever needed (like mypackage.lisp ).

Languages that use this latter model include Smalltalk and InterLisp.

---

In order to do image based development in Common Lisp, certain tools
are needed:

a. A way of editing a program, like a structure editor

b. A way of writing a text form of the application when desired (item 5
above)

c. The interpreter / compiler should be able to save / load an image

I have completed item "a" (to be released shortly). I will write item
"b" shortly. Item "c" is already included in many Lisp interpreters /
compilers. Those without it can save/load a text form that will be
provided by item "b", although this is somewhat clunky.

I been interested in image based development for some time. I thought
this would be a good road to investigate. Your input is appreciated.

Thanks.

Blake McBride
37 Answers

Pascal J. Bourguignon

8/28/2015 5:47:00 PM

0

Blake McBride <blake1024@gmail.com> writes:

> I been interested in image based development for some time. I thought
> this would be a good road to investigate. Your input is appreciated.

http://www.informat...develop/lisp/com/informatimago/small-cl-...
http://www.informat...develop/lisp/com/informatimago/small-cl-p...

--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

Blake McBride

8/28/2015 5:57:00 PM

0

On 08/28/2015 12:46 PM, Pascal J. Bourguignon wrote:
> Blake McBride <blake1024@gmail.com> writes:
>
>> I been interested in image based development for some time. I thought
>> this would be a good road to investigate. Your input is appreciated.
>
> http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-...
> http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-p...
>

Thanks. I knew about sedit. The structure editor I will be releasing
is quite a bit more substantial.

Basically, my LISPF4 InterLisp clone contains a clone of a substantial
subset of the standard InterLisp structure editor. I ported that to
Common Lisp. A copy of the manual appears at the end of this message.

I will look into your ibcl. That may make it unnecessary for my next step.

Thanks!

Blake


-----

EDIT - Structure editor for Common Lisp

This code was taken from the LISPF4 project and was enhanced and
converted to Common Lisp by Blake McBride. The LISPF4 editor is an
implementation of the structure editor that came with InterLisp.

In order for editing of functions to work, they must have been defined
using the "defun" or "defmacro" defined in this package.


Several edit functions are implemented:

(EDITF fn edcom) edit a function or macro. Value = NIL.
(EDITS s edcom) edit any s-expr. Value = s
(EDITV v edcom) edit variable v
(EDITP s edcom) edit the property list associated with s
edcom = list of edit commands
(or NIL). If edcom is non-NIL the commands
will be executed and the editor will exit.

In what follows cexpr is the current expression.

The following commands are implemented.

OK Saves the changes and leaves the editor
STOP Exits the editor without saving
SAVE Saves edit for future edit session (only EDITF)

Display:

P Print to level 2
PP PrettyPrint to level 2
? Print to level 100
?? PrettyPrint to level 100

Positioning the cexpr:

! sets cexpr to top level expression
n Set cexpr to the n'th element of cexpr.
-n Set cexpr to the n'th element from the end of
cexpr.
0 ascend one level.
NX next expression
(descend to the next element one level above)
UP Ascend one level but only display elements to the
right of the original cexpr.
F expr searches the first occurrence of expr
in the cexpr regardless of level

(MARK atm) Set atom atm to the current edit position.
(/ atm) Go to position marked by atom atm

Expression editing:

Adds:
(-n e1 ...) inserts e1 ... before the n'th element.
(N e1 ...) adds e1 ... after the last element within cexpr.
(A e1 ...) Adds e1 ... AFTER cexpr.
(B e1 ...) Adds e1 ... BEFORE cexpr.
Replacing:
(n e1 ...) n >= 1 replaces the n'th expression by e1 ...
(: e1 ...) Replaces the entire current expression by e1 ...
(R x y) All occurrences of x are replaced by y in cexpr.
(MBD e1 ...) Replace cexpr with e1 ... and allow * to represent
the original expression.
Ex.: We have (PRINT X) and we want
(COND ((NULL L) (PRINT X) NIL)
(T (PRINT X) (GO LOP)))
we do
(MBD (COND ((NULL L) * NIL)
(T * (GO LOP))))
(XTR e1 ...) Ex.: We have (COND ((NULL L) NIL)
(T (PRINT L))
and we want (PRINT L)
we do
(XTR 3 2), (XTR (PRINT L)) or
(XTR PRINT)

Deletions:
(n) n >= 1 deletes the n'th expression of cexpr
(:) Delete the current expression.

Global editing:

S x Set x to the current expression.
(US x cmds) Execute edit commands cmds with the ability to
utilize the expression in atom x
S and US can be used in different edit sessions.

Ex.: Move the PROG expression of FOO to be the PROG expression of
another function FII.

(EDITF FOO)
F PROG S DEF OK
(EDITF FII)
(US DEF (3 DEF)) OK

The 3'rd element (the prog expression of FII) is replaced by the one
stored in DEF.

Parenthesis manipulation:

(BI n m) Both In. A left parenthesis is inserted before
the n'th element and a right parenthesis is
inserted after the m'th element.
(BI n) insert parenthesis around the n'th element
(BO n) Both Out. Removes both parenthesis from the
n'th element.
(LI n) Left In. Inserts a left parenthesis before the
n'th element and a corresponding right at the end
(LO n) Left Out. Removes the left parenthesis from the
n'th element. All elements after the n'th element
are deleted.
(RI n m) Right In. Move the parenthesis at the end of the
n'th element in to after the m'th element inside
the n'th element.
(RO n) Right Out. Move the right parenthesis of the n'th
element to the end of the current expression. All
elements following the n'th element are moved
inside the n'th element.

Evaluation:

E expr Evaluate expression expr.

(ESET x c1...) Sets atom x to the edit commands c1...
x Executes the edit commands associates with atom x.
(ESET x) Disassociates all edit commands from atom x.


Kaz Kylheku

8/28/2015 6:25:00 PM

0

On 2015-08-28, Blake McBride <blake1024@gmail.com> wrote:
>
> A popular development scenario that I term "disk based" looks like the
> following:
>
> A. A program is created / edited with a text editor (like emacs)
>
> B. The code is saved to a disk file (like myprogram.lisp )
>
> C. A language interpreter / compiler loads (from disk or a socket)
> and runs the code where the programmer evaluates its performance
>
> D. Go back to A.
>
> ---
>
> There is another development scenario that is old, but may be worth
> looking into. I term this other method "image based" and it looks like
> the following:
>
> 1. Code is added and edited right in the environment where it is being
> used (like CCL, SBCL, CLISP, etc.). Editing the code could be done
> with an editor like a structure editor written in Lisp rather than a
> text editor.
>
> 2. Run the code right in the environment it was created in.
>
> 3. Go to step 1 in order to continue development.

Purely image based is stupid, because the image is some binary cruft
that you canno version control, or port to other systems.
In some Lisps, images require a separate executale which loads them,
and sometimes newer versions of that executable wont' load old image
sor vice versa.

The hybrid approach is this:

1. Run one image.
2. Edit important code in a text editor, saving to a file.
3. Load modified files into the image to replace definitions with
new ones. (Perhaps using a build system like ASDF).
4. Directly, in the image, write only throwaway functions for testing,
and use the REPL for exploring and debugging. If anything is
to be retained, paste it into a file.
5. Optionally save the image to checkpoint the state or other reasons.

Lisp environments like Slime try to make it mostly seamless, because
you can evaluate code into the image out of the editor.

Speaking of image saving, it is important even if you don't use it
for development, because it's one of the ways of creating standalone
applications.

Also, your Lisp probably loads fast, even though it is loaded with functions,
because it's actually restoring an image, and not actually evaluating hundreds
of defuns and defmethods.

Emacs starts from an image, using a low-level C technique of
dumping memory and then reloading it.

I worked on a project which had a Make rule tree that too 30 seconds to read
and process. So even the tiniest incremental build took 30 seconds from the
time you typed "make" to the one-file compile, and link (which themselves took
a fraction of a second)!

I got sick of it and ripped the undumping code out of GNU Emacs, transplanting
it into GNU Make. I then had something like "make --dump file" which produced
a core dump in file, and a "make --restore file" (load the dump and build
without reading Makefile).

It became virtually instant to do incremental builds. Of course, if you
changed the rules, you had to re-do the dump: 30 seconds once in a while
was better better than 30 seconds every time.

Barry Margolin

8/28/2015 7:59:00 PM

0

In article <HY-dneQ1sqHaCX3InZ2dnUU7-X2dnZ2d@supernews.com>,
Blake McBride <blake1024@gmail.com> wrote:

> I been interested in image based development for some time. I thought
> this would be a good road to investigate. Your input is appreciated.

I remember reading papers in SIGPLAN or LCS Technical Reports 30+ years
ago about this. Some people theorized that the file-based model would go
away within a decade, as GUI programming languages emerged. They seemed
to think that non-programmers would be able to do real programming with
drag-and-drop.

As we can see, this never happened. The closest we have are web
applications that make it easy for people to make simple web sites. The
grand expectations reminded me of COBOL -- its syntax is very
English-like, and the idea was that it would be understandable to
management. But I wonder how many managers ever really looked at the
code under the hood.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

Pascal J. Bourguignon

8/28/2015 8:52:00 PM

0

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <HY-dneQ1sqHaCX3InZ2dnUU7-X2dnZ2d@supernews.com>,
> Blake McBride <blake1024@gmail.com> wrote:
>
>> I been interested in image based development for some time. I thought
>> this would be a good road to investigate. Your input is appreciated.
>
> I remember reading papers in SIGPLAN or LCS Technical Reports 30+ years
> ago about this. Some people theorized that the file-based model would go
> away within a decade, as GUI programming languages emerged. They seemed
> to think that non-programmers would be able to do real programming with
> drag-and-drop.
>
> As we can see, this never happened.

Graphical programming languages exist, here are a few examples:

http://www.dangermouse.net/esoteric...
http://code.google.com...
http://drakon-editor.sourceforge.net/lan...

What doesn't happen though is non-programmers doing real programming.


> The closest we have are web
> applications that make it easy for people to make simple web sites. The
> grand expectations reminded me of COBOL -- its syntax is very
> English-like, and the idea was that it would be understandable to
> management. But I wonder how many managers ever really looked at the
> code under the hood.

None unfortunately.

--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

Pascal J. Bourguignon

8/29/2015 4:42:00 AM

0

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <HY-dneQ1sqHaCX3InZ2dnUU7-X2dnZ2d@supernews.com>,
> Blake McBride <blake1024@gmail.com> wrote:
>
>> I been interested in image based development for some time. I thought
>> this would be a good road to investigate. Your input is appreciated.
>
> I remember reading papers in SIGPLAN or LCS Technical Reports 30+ years
> ago about this. Some people theorized that the file-based model would go
> away within a decade, as GUI programming languages emerged. They seemed
> to think that non-programmers would be able to do real programming with
> drag-and-drop.

Well first point is completed: iOS and Android essentially don't have a
(user visible) file system anymore.



> As we can see, this never happened.

Look better.



--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

Ivan Kanis

8/29/2015 2:02:00 PM

0

August, 28 at 15:58 Barry Margolin wrote:

> The grand expectations reminded me of COBOL -- its syntax is very
> English-like, and the idea was that it would be understandable to
> management. But I wonder how many managers ever really looked at the
> code under the hood.

And now we have Python... At least Pythonists are not trying to sell it
to managers.

Ivan

--
The price of wisdom is above the rubies.
-- Job ch. 30, v. 18

Kaz Kylheku

8/29/2015 2:42:00 PM

0

On 2015-08-28, Barry Margolin <barmar@alum.mit.edu> wrote:
> In article <HY-dneQ1sqHaCX3InZ2dnUU7-X2dnZ2d@supernews.com>,
> Blake McBride <blake1024@gmail.com> wrote:
>
>> I been interested in image based development for some time. I thought
>> this would be a good road to investigate. Your input is appreciated.
>
> I remember reading papers in SIGPLAN or LCS Technical Reports 30+ years
> ago about this. Some people theorized that the file-based model would go
> away within a decade, as GUI programming languages emerged. They seemed
> to think that non-programmers would be able to do real programming with
> drag-and-drop.

What actually happened is that *applications* did away with the file-based
model.

The image-based model is what you see in office applications: word
processors, spreadsheets and so on.

A binary word-processor document is monolithic image of objects dumped to disk.

A programmer wants to use a markup language, in which content like graphical
images and style sheets are referenced as separate files.

Barry Margolin

8/30/2015 2:19:00 AM

0

In article <87bndqzowg.fsf@kuiper.lan.informatimago.com>,
"Pascal J. Bourguignon" <pjb@informatimago.com> wrote:

> Barry Margolin <barmar@alum.mit.edu> writes:
>
> > In article <HY-dneQ1sqHaCX3InZ2dnUU7-X2dnZ2d@supernews.com>,
> > Blake McBride <blake1024@gmail.com> wrote:
> >
> >> I been interested in image based development for some time. I thought
> >> this would be a good road to investigate. Your input is appreciated.
> >
> > I remember reading papers in SIGPLAN or LCS Technical Reports 30+ years
> > ago about this. Some people theorized that the file-based model would go
> > away within a decade, as GUI programming languages emerged. They seemed
> > to think that non-programmers would be able to do real programming with
> > drag-and-drop.
>
> Well first point is completed: iOS and Android essentially don't have a
> (user visible) file system anymore.

They also don't have editors for writing programs on the devices, so
that's a non-sequitor.

When writing applications for these devices, you use editors on personal
computers, and they still use the file model.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

Pascal J. Bourguignon

8/30/2015 7:03:00 AM

0

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <87bndqzowg.fsf@kuiper.lan.informatimago.com>,
> "Pascal J. Bourguignon" <pjb@informatimago.com> wrote:
>
>> Barry Margolin <barmar@alum.mit.edu> writes:
>>
>> > In article <HY-dneQ1sqHaCX3InZ2dnUU7-X2dnZ2d@supernews.com>,
>> > Blake McBride <blake1024@gmail.com> wrote:
>> >
>> >> I been interested in image based development for some time. I thought
>> >> this would be a good road to investigate. Your input is appreciated.
>> >
>> > I remember reading papers in SIGPLAN or LCS Technical Reports 30+ years
>> > ago about this. Some people theorized that the file-based model would go
>> > away within a decade, as GUI programming languages emerged. They seemed
>> > to think that non-programmers would be able to do real programming with
>> > drag-and-drop.
>>
>> Well first point is completed: iOS and Android essentially don't have a
>> (user visible) file system anymore.
>
> They also don't have editors for writing programs on the devices, so
> that's a non-sequitor.
>
> When writing applications for these devices, you use editors on personal
> computers, and they still use the file model.

Actually, there are several editors both on iOS and Android.

On Android there are even complete stand alone IDE allowing you to
develop locally Android applications.

But still, despite the use of unix kernels in those systems, they try
very hard, with sandboxes and restrictions, to prevent two applications
to process the same data files. This in effects nullify the notion of
file for the user, even if some tools like IDE and "file managers" on
Android still let programmers see them. The end user can only duplicate
the data by "sharing", ie., sending a copy, o ironia tempore, to a
different application sandbox.


Clearly, those systems are application centric, because this is where
Apple and Google can make money, selling applications.

But a computer system for users would be file centric, since this is
where the data of the users, owned by the users, and relevant to the
users, is stored. Applications are irrelevant to users, mere tools to
process their data. Even for games! As soon as the game is not
trivial, playing with it the user creates a data structure that is his
own, and that he might want to process with other tools than the game
itself. But he doesn't have those freedoms, since the system is here to
extract money from the user, not to serve his purposes.


Some people wonder why GNU/Linux is not established on the "desktop" yet.
They should not. It will never (at least not while still remaining GNU;
there's not much GNU stuff in Android or iOS). Not because of license,
but because of this fundamental philosophical difference. Desktops
(MS-Windows, MacOSX) are too strongly stressing the application side of
the duality, even if files are still a notion there. For example, files
are marked by the application signature, so that by default, it is
always processed by the same application.


On a unix (GNU/linux) system:

$ ls ~/Desktop/*.txt
/home/pjb/Desktop/20140308--apple--commande.txt
/home/pjb/Desktop/220446114-At-Last-Why-Sugar-Kills.txt
/home/pjb/Desktop/DOC-488531.txt
/home/pjb/Desktop/out.txt
/home/pjb/Desktop/pjb-notes.txt

files are not assigned to an application. You can process them with any
tool you want:

$ grep -A1 deadline ~/Desktop/pjb-notes.txt
| I love deadlines. I like the whooshing sound they make as they fly by.
| -- Douglas Adams
$ emacs ~/Desktop/pjb-notes.txt
...

(Don't be blinded by the text file format, the same works with any file
format, for example JPG, AVI, whatever. Perhaps not with proprietary
file formats, but nowadays even Microsoft Word writes xml files).


If you want to make a difference and establish GNU/Linux "on the
desktop", instead of building an application centric system that
encloses the users in a money extracting machinery, provide a file
centric GUI that lets user process their files with any program.
Including programs (scripts) they'll write themselves!


Of course, on iOS and Android, you have to go thru the filter of
capitalistic corporations whose only purpose is to amass astronomical
and meaningless amounts of money, so they won't let you do that, since
there's no money to be extracted from user data stored in user files on
user hard disks or sdcards.

--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk