Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Giving Up! (was "UNWIND_PROTECT in Scheme")
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joe Marshall  
View profile  
 More options May 14 2003, 2:18 pm
Newsgroups: comp.lang.lisp
From: Joe Marshall <j...@ccs.neu.edu>
Date: 14 May 2003 14:18:25 -0400
Local: Wed, May 14 2003 2:18 pm
Subject: Re: Giving Up! (was "UNWIND_PROTECT in Scheme")

Mark Conrad <nos...@iam.invalid> writes:
> I really thought there was a way for me to 'escape' from deeply nested
> code within the body of my program, ending the execution of my program
> mid-cycle, so to speak, winding up at toplevel with my program stopped
> dead in its tracks. (as catch and throw can do) - all this by using
> simple CL code like cond, cons, car, cdr, etc.

This is not possible in general in Common Lisp.  (There may be
implementations that allow this, but the ability to do this is not
required.)  You *can* escape to top level using a catch and throw, but
your program is *terminated* when you do so.  It is not just stopped
dead in its tracks, it is removed from the track altogether.

You can fake it in Common Lisp.  The issue is that there is
irrecoverable state on the stack.  The solution is to remove that
state from the stack and keep it in closures.  Paul Graham's macros
make this easier to accomplish.

> My aim was to eventually demonstrate that a lot of those constructs
> could be duplicated in their actions by substituting continuations in
> place of the legitimate constructs like catch, throw, and possibly even
> unwind-protect.

You can indeed model these constructs with continuations, but since
you are faking the continuations, you'll have to fake these as well.

> The suggestions that some have suggested I consider was to use the
> built-in CL constructs "eval-when" and/or "define-symbol-macro" in
> order to 'force' Paul Graham's old code to work in an ANSI environment.

> I am against that approach on principle,

Consider carefully what you are saying:  `I am against using CL
constructs to make Paul Graham's code work.'  Not too many people go
out of their way to

   a) make their task more difficult

   b) have non-working code as goal

   c) elevate these to a `principle'

> because when I want my toplevel non-special variable %cont% to have
> a value of 'foo - - then I want it to stay that way until I myself
> change it - - - eval-when does not allow that to happen, my 'foo
> value gets magically messed with in behind-the-scenes manipulation
> by either eval-when or define-symbol-macro, I don't know which one
> (or both) of those constructs does the messing with the toplevel
> value of my variable, but I don't like it.

I'll try saying this again:  DO NOT USE DEFINE-SYMBOL-MACRO!
Remove it.  Delete it.  It does not do what you think it does, and it
does not do what you want.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.