From: Mark Conrad
Subject: How to determine what is not possible in emacs?
Date: 
Message-ID: <240320041909074522%NoSpamDammit@invalid.com>
As a fun project, I plan to start a project to create as many
"workarounds" as possible for the ancient version of emacs that is
included with the latest Mac OS 10.3.3

That emacs does not even have gensym. (ugh)

I have heard that early 'dynamic' versions of Lisp could be made to
mimic a  _lot_  of the functionality of modern lexical Lisps, at the
price of including a lot more Lisp code.
(to implement lame closures, generators, possibly even lame
continuations ala Paul Graham)

How true is it that emacs might be modernized against-its-will?

I have forgotten how old-dynamic-Lisp code works, so will need to
locate some very old Lisp books to bring myself down-to-snuff.<g>

Mark-

From: Pascal Bourguignon
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <87n065zfig.fsf@thalassa.informatimago.com>
Mark Conrad <············@invalid.com> writes:

> As a fun project, I plan to start a project to create as many
> "workarounds" as possible for the ancient version of emacs that is
> included with the latest Mac OS 10.3.3

Perhaps you should upgrade to MacOSX?
 

> That emacs does not even have gensym. (ugh)

I've got emacs 21.2.1 on MacOSX 10.3.3.  


No emacs comes with a gensym, even the latest 21.3.1. 
You've got to fetch it from cl.el:

(require 'cl)
(show (gensym))
;; --> G58983



> I have heard that early 'dynamic' versions of Lisp could be made to
> mimic a  _lot_  of the functionality of modern lexical Lisps, at the
> price of including a lot more Lisp code.
> (to implement lame closures, generators, possibly even lame
> continuations ala Paul Graham)

Of course.  You can even  implement a full fleshed common-lisp in
emacs lisp.  Or better, you can fetch it from the Internet:

    http://www.nocrew.org/cgi-bin/cvsweb/cvsweb.cgi/emacs-cl/


> How true is it that emacs might be modernized against-its-will?

Stallman wants to modernize emacs into scheme...

Anyway, I find it a little silly: it's not because scheme is powerful
_enough_ a language in which one can implement one's own prefered
language that a true programming language like Common-Lisp (vs. a toy)
should not be used directly.  

 
> I have forgotten how old-dynamic-Lisp code works, so will need to
> locate some very old Lisp books to bring myself down-to-snuff.<g>

There's not a lot of differences for casual programming.


As a fun project, 
the best workaround to emacs would be IMO, to use hemlock.

-- 
__Pascal_Bourguignon__                     http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/
From: Mark Conrad
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <250320041527102618%NoSpamDammit@invalid.com>
In article <··············@thalassa.informatimago.com>, Pascal
Bourguignon <····@thalassa.informatimago.com> wrote:

> I've got emacs 21.2.1 on MacOSX 10.3.3.  

I have the same version  21.2.1  in my OSX here, on a Mac "Pismo"
powerbook.  I understand this version of emacs was written way back in
1995.

I don't know how difficult it is to install the more recent version of
emacs, or if the resulting gains are worth the effort.


> No emacs comes with a gensym, even the latest 21.3.1. 
> You've got to fetch it from cl.el:
> 
> (require 'cl)
> (show (gensym))
> ;; --> G58983

Thanks for that info'

IMO, gensym is necessary to circumvent bugs when writting macros.



> > I have heard that early 'dynamic' versions of Lisp could be made to
> > mimic a  _lot_  of the functionality of modern lexical Lisps, at the
> > price of including a lot more Lisp code.
> > (to implement lame closures, generators, possibly even lame
> > continuations ala Paul Graham)
> 
> Of course.  You can even  implement a full fleshed common-lisp in
> emacs lisp.

Ahh, but that is no fun, just 'calling' a better version of Lisp from
emacs.   I want to battle the old version of emacs head-on, just to see 
what I can force it to do by using sneaky roundabout Lisp code.

Can't tell, I might even learn something in the process.




> Stallman wants to modernize emacs into scheme...
> 
> Anyway, I find it a little silly: it's not because scheme is powerful
> _enough_ a language in which one can implement one's own prefered
> language that a true programming language like Common-Lisp (vs. a toy)
> should not be used directly.  

Well, Stallman's desire to modernize emacs into Scheme might have some
fringe benefits.

Not everyone who runs emacs is willing to learn CL.   Those people
would benefit from the added power of Scheme.

Remember the sizes of the Scheme 'standard' manual as compared to the
bulky CL 'standard' manual.<g>   (paper version)

I agree though that CL, right out of the box, is ready to do industrial
strength jobs that would require a lot of code writing effort in
Scheme.

Mark-
From: Alan Shutko
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <87r7vgzdgu.fsf@wesley.springies.com>
Mark Conrad <············@invalid.com> writes:

> I have the same version  21.2.1  in my OSX here, on a Mac "Pismo"
> powerbook.  I understand this version of emacs was written way back in
> 1995.

Where did you get that idea?  I believe it was released in March
2002.  21.3 was about a year ago.  

> I don't know how difficult it is to install the more recent version of
> emacs, or if the resulting gains are worth the effort.

Should be very easy, but check
http://www.gnu.org/software/emacs/NEWS.21.3 to see if it's worth it.

>> Of course.  You can even  implement a full fleshed common-lisp in
>> emacs lisp.
>
> Ahh, but that is no fun, just 'calling' a better version of Lisp from
> emacs.   I want to battle the old version of emacs head-on, just to see 
> what I can force it to do by using sneaky roundabout Lisp code.

That's not what the link Pascal supplied is doing.  From its readme:

    Emacs Common Lisp is an implementation of Common Lisp, written in
    Emacs Lisp.  It does not yet purport to conform to the ANSI
    standard since, among other things, COMPILE-FILE, CLOS, and pretty
    printing are missing.  However, most other Common Lisp features
    like lexical closures, packages, readtables, multiple values,
    bignums, adjustable arrays, etc, are present.  At this stage many
    bugs remain and error checking is sparse.

Sounds like it's exactly what you want to do.

-- 
Alan Shutko <···@acm.org> - I am the rocks.
Veni, vidi, VCR: I came, I saw, I dubbed.
From: Mark Conrad
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <270320041211114202%NoSpamDammit@invalid.com>
In article <··············@wesley.springies.com>, Alan Shutko
<···@acm.org> wrote:

> > I have the same version  21.2.1  in my OSX here, on a Mac "Pismo"
> > powerbook.  I understand this version of emacs was written way back in
> > 1995.
> 
> Where did you get that idea?  I believe it was released in March
> 2002.  21.3 was about a year ago. 

From the man page on emacs, just immediately before "(End)" near the
end of the man pages.

The line was:
"4th Berkely Distribution   1995 December 7   EMACS(1)"

I may have misunderstood it.
Does that date pertain to something else?



> > I don't know how difficult it is to install the more recent version of
> > emacs, or if the resulting gains are worth the effort.
> 
> Should be very easy, but check
> http://www.gnu.org/software/emacs/NEWS.21.3 to see if it's worth it.

I just checked, there don't appear to be major changes that would be
worth installing the new version, IMO.





> >> Of course.  You can even  implement a full fleshed common-lisp in
> >> emacs lisp.
> >
> > Ahh, but that is no fun, just 'calling' a better version of Lisp from
> > emacs.   I want to battle the old version of emacs head-on, just to see 
> > what I can force it to do by using sneaky roundabout Lisp code.
> 
> That's not what the link Pascal supplied is doing.  From its readme:
> 
>     Emacs Common Lisp is an implementation of Common Lisp, written in
>     Emacs Lisp.  It does not yet purport to conform to the ANSI
>     standard since, among other things, COMPILE-FILE, CLOS, and pretty
>     printing are missing.  However, most other Common Lisp features
>     like lexical closures, packages, readtables, multiple values,
>     bignums, adjustable arrays, etc, are present.  At this stage many
>     bugs remain and error checking is sparse.
> 
> Sounds like it's exactly what you want to do.

Wow! - that sounds great, provided I can somehow get access to the
source-code of  "Emacs Common Lisp" - so I will be able to see how they
forced the ordinary (old-style 'dynamic') version of emacs to implement
lexical closures.

Amazing! - I was not certain it was possible.

I don't believe it is possible to force the old version of emacs to
implement the CL functions   "read-char-no-hang"  and  "listen",
because I think the shell that emacs runs in forces one to press the
"return" key after keyboard input.

But the fact they got lexical closures implemented should greatly
extend the power of emacs.

Of course, dechiphering the source code of "Emacs Common Lisp" in order
to find out exactly how they did those things may be beyond my present
technical abilities.

...but I would like to try to dechipher their source code anyhow.

Where to start, where to start.....don't know.

They  _did_  say   "...written in (old) Emacs Lisp", which implies that
they did not go into the underlying C language at all.

Thanks for that info', I will beat the bushes in all the obvious places
to try to find the source code.

Mark-
From: szymon
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <871xnd9avc.fsf@wp.pl>
Mark Conrad <············@invalid.com> writes:

> 
> Wow! - that sounds great, provided I can somehow get access to the
> source-code of  "Emacs Common Lisp" - so I will be able to see how they
> forced the ordinary (old-style 'dynamic') version of emacs to implement
> lexical closures.
> 
> Amazing! - I was not certain it was possible.
> 
> I don't believe it is possible to force the old version of emacs to
> implement the CL functions   "read-char-no-hang"  and  "listen",
> because I think the shell that emacs runs in forces one to press the
> "return" key after keyboard input.
> 
> But the fact they got lexical closures implemented should greatly
> extend the power of emacs.


I found this in "ANSI Common Lisp" by P.G. {page 107}:

"... When a function refers to a variable defined outside it, it's
called a *free* variable. A function that refers to a free lexical
variable is called *closure*[2]. ..."

"[2] The name "closure" is left over from earlier Lisp dialects. It
derivies from the way closures have to be implemented under dynamic
scope."

Q: Does "old closures" behaves as lexical ones? (from user point of
view)


regards, szymon.
From: Pascal Costanza
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <c47335$r8a$1@newsreader2.netcologne.de>
szymon wrote:

> Q: Does "old closures" behaves as lexical ones? (from user point of
> view)

Not necessarily. In 
http://www.unlambda.com/lispm/explorer-docs/e3-docs/sect12.txt you can 
find descriptions for dynamic closures and lexical closures. (However, I 
don't know how "old" that Lisp actually is.)

The "lambda papers" by Sussman and Steele provide a lot of background 
information about the issues involved. See 
http://library.readscheme.org/page1.html


Pascal

-- 
1st European Lisp and Scheme Workshop
June 13 - Oslo, Norway - co-located with ECOOP 2004
http://www.cs.uni-bonn.de/~costanza/lisp-ecoop/
From: Rahul Jain
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <87k714onx6.fsf@nyct.net>
Pascal Costanza <········@web.de> writes:

> szymon wrote:
>
>> Q: Does "old closures" behaves as lexical ones? (from user point of
>> view)
>
> Not necessarily. In
> http://www.unlambda.com/lispm/explorer-docs/e3-docs/sect12.txt you can
> find descriptions for dynamic closures and lexical closures. (However, I
> don't know how "old" that Lisp actually is.)

My impression is that lexical closures were the original type of
closure, and dynamic closures are a bit more advanced and more difficult
to implement properly. Somewhere between lexical closures and
first-class non-linear continuations. (CL already has linear
continuations that can be almost considered first-class, as a non-local
exit can be passed as a parameter -- most generally as a restart.)

-- 
Rahul Jain
·····@nyct.net
Professional Software Developer, Amateur Quantum Mechanicist
From: John Thingstad
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <opr5lc3mgxxfnb1n@news.chello.no>
Nop you got that backwards.
Dynamic closure was the only form of closure in the original McCartey lisp.
It was chosen because it fell naturally from the algorithm.
Lexical closures were introdused in scheme and adopted by Common lisp
but are more difficult to implement.

On Sun, 28 Mar 2004 12:56:53 -0500, Rahul Jain <·····@nyct.net> wrote:

> Pascal Costanza <········@web.de> writes:
> My impression is that lexical closures were the original type of
> closure, and dynamic closures are a bit more advanced and more difficult
> to implement properly. Somewhere between lexical closures and
> first-class non-linear continuations. (CL already has linear
> continuations that can be almost considered first-class, as a non-local
> exit can be passed as a parameter -- most generally as a restart.)
>

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
From: Rahul Jain
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <878yhko44p.fsf@nyct.net>
John Thingstad <··············@chello.no> writes:

> Nop you got that backwards.
> Dynamic closure was the only form of closure in the original McCartey lisp.

Incorrect. Dynamic scoping implies nothing about dynamic closure. In the
original Lisps it was impossible to create a closure at all (without
doing it manually, like you would in C).

-- 
Rahul Jain
·····@nyct.net
Professional Software Developer, Amateur Quantum Mechanicist
From: Julian Stecklina
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <86u1081wli.fsf@web.de>
John Thingstad <··············@chello.no> writes:

> Lexical closures were introdused in scheme and adopted by Common lisp
> but are more difficult to implement.

I have a small scheme-like interpreter written in x86 assembly
language on FreeBSD, I found it quite easy to implement lexical
closures, even though I had not have any experience writting
interpreters/compilers. But I never got to adding special
variables and thus dynamic closures. Just my two cents, quite
off-topic I know...

Regards,
-- 
Julian Stecklina 

Signed and encrypted mail welcome.
Key-Server: pgp.mit.edu         Key-ID: 0xD65B2AB5
FA38 DCD3 00EC 97B8 6DD8  D7CC 35D8 8D0E D65B 2AB5

Any sufficiently complicated C or Fortran program
contains an ad hoc informally-specified bug-ridden
slow implementation of half of Common Lisp.
 - Greenspun's Tenth Rule of Programming
From: Alan Shutko
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <87zna1vwyn.fsf@wesley.springies.com>
Mark Conrad <············@invalid.com> writes:

> The line was:
> "4th Berkely Distribution   1995 December 7   EMACS(1)"
>
> I may have misunderstood it.
> Does that date pertain to something else?

It does.  I think it was when the man page was first written....


-- 
Alan Shutko <···@acm.org> - I am the rocks.
There's obviously been some sort of silly mistake.
From: Lars Brinkhoff
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <858yhlz8i7.fsf@junk.nocrew.org>
Mark Conrad <············@invalid.com> writes:
> I don't believe it is possible to force the old version of emacs to
> implement the CL functions "read-char-no-hang" and "listen", because
> I think the shell that emacs runs in forces one to press the
> "return" key after keyboard input.

READ-CHAR(-NO-HANG) is implemented with read-char-exclusive.  LISTEN
is implemented by examining the return value of sit-for.

> But the fact they got lexical closures implemented should greatly
> extend the power of emacs.  Of course, dechiphering the source code
> of "Emacs Common Lisp" in order to find out exactly how they did
> those things may be beyond my present technical abilities.

Closures are implemented by heap-allocating storage and directing
references to free variables there, much the same as any CL
implementation would do it.

-- 
Lars Brinkhoff,         Services for Unix, Linux, GCC, HTTP
Brinkhoff Consulting    http://www.brinkhoff.se/
From: Barry Margolin
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <barmar-187CAC.05513029032004@comcast.ash.giganews.com>
In article <·······························@invalid.com>,
 Mark Conrad <············@invalid.com> wrote:

> In article <··············@wesley.springies.com>, Alan Shutko
> <···@acm.org> wrote:
> 
> > > I have the same version  21.2.1  in my OSX here, on a Mac "Pismo"
> > > powerbook.  I understand this version of emacs was written way back in
> > > 1995.
> > 
> > Where did you get that idea?  I believe it was released in March
> > 2002.  21.3 was about a year ago. 
> 
> From the man page on emacs, just immediately before "(End)" near the
> end of the man pages.
> 
> The line was:
> "4th Berkely Distribution   1995 December 7   EMACS(1)"

That's the date that the man page was last updated, not when the 
application itself was.

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
From: Thomas A. Russ
Subject: Re: How to determine what is not possible in emacs?
Date: 
Message-ID: <ymiisgnsi5y.fsf@sevak.isi.edu>
Mark Conrad <············@invalid.com> writes:
> 
> From the man page on emacs, just immediately before "(End)" near the
> end of the man pages.
> 
> The line was:
> "4th Berkely Distribution   1995 December 7   EMACS(1)"
> 
> I may have misunderstood it.
> Does that date pertain to something else?

Yes.  It is the date that the man page was created.  The man
pages are not necessarily updated as often as the code.



-- 
Thomas A. Russ,  USC/Information Sciences Institute