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
Declare and Progn
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
David McClain  
View profile  
 More options Oct 22 2001, 7:19 pm
Newsgroups: comp.lang.lisp
From: "David McClain" <bar...@qwest.net>
Date: Mon, 22 Oct 2001 16:21:44 -0700
Local: Mon, Oct 22 2001 7:21 pm
Subject: Declare and Progn
Hi,

I'm curious about the reason why a (DECLARE ...) clause is not valid after a
PROGN, but it is after any form that produces bindings, like PROG, PROG*,
LET, DEFUN, etc, etc.

In particular I tried to write a macro that expanded to this:

(progn
    (declare (optimize (debug 2)))
    ..... )  ;; body of code

This is rejected, but the following works okay,

(let ()
    (declare (optimize (debug 2)))
    ....)  ;; body of code

Not complaining, mind you... I realize a lot of very great talent applied
their best thinking to this language. I'm just curious about why binding
influences are needed in preparation for a (DECLARE (OPTIMIZE ...))

- D.McClain


 
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.
Erik Naggum  
View profile  
 More options Oct 22 2001, 7:41 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Mon, 22 Oct 2001 23:41:55 GMT
Local: Mon, Oct 22 2001 7:41 pm
Subject: Re: Declare and Progn
* "David McClain" <bar...@qwest.net>
| I'm curious about the reason why a (DECLARE ...) clause is not valid after a
| PROGN, but it is after any form that produces bindings, like PROG, PROG*,
| LET, DEFUN, etc, etc.

  Because you should use the special operator locally to do this, not progn.

///
--
  Norway is now run by a priest from the fundamentalist Christian People's
  Party, the fifth largest party representing one eighth of the electorate.
--
  The purpose of computing is insight, not numbers.   -- Richard Hamming


 
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.
Barry Margolin  
View profile  
 More options Oct 22 2001, 7:48 pm
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@genuity.net>
Date: Mon, 22 Oct 2001 23:48:44 GMT
Local: Mon, Oct 22 2001 7:48 pm
Subject: Re: Declare and Progn
In article <3Q1B7.885$ZD5.178...@news.uswest.net>,

David McClain <bar...@qwest.net> wrote:
>Hi,

>I'm curious about the reason why a (DECLARE ...) clause is not valid after a
>PROGN, but it is after any form that produces bindings, like PROG, PROG*,
>LET, DEFUN, etc, etc.

The point of the DECLARE in the body of these things is to make a
declaration about one of the variables that they introduce.  Since PROGN
doesn't introduce any new variables, why does it need to allow
declarations?

>In particular I tried to write a macro that expanded to this:

>(progn
>    (declare (optimize (debug 2)))
>    ..... )  ;; body of code

Isn't this what LOCALLY is for?

(locally
  (declare (optimize (debug 2)))
  ...)

I suppose we probably could have done without LOCALLY, and simply stated
that PROGN allows declarations at the beginning and their scope is the
PROGN form.  However, PROGN has the nice associative property that:

(progn a b c ... (progn d e f ...))

is equivalent to:

(progn a b c ... d e f ...)

This equivalence breaks down if you allow special cases in certain
positions.

--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.


 
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.
Kent M Pitman  
View profile  
 More options Oct 22 2001, 7:55 pm
Newsgroups: comp.lang.lisp
From: Kent M Pitman <pit...@world.std.com>
Date: Mon, 22 Oct 2001 23:54:36 GMT
Local: Mon, Oct 22 2001 7:54 pm
Subject: Re: Declare and Progn

You've got causality backward.  It isn't that binding influences are
needed in pre of a DECLARE, but rather that because there are bindings
being done, DECLARE must be made available to control things like the
possibility of SPECIAL and DYNAMIC-EXTENT.  In the case of PROGN,
nothing forces this need, so DECLARE isn't required to be handled there.

But also, a practical implication of what you want is that implicit
progns would also be affected.  This would mean that every user macro
that had a progn or implicit progn would have to manage declaration
processing.  In general, that's quite a pain.  Often the declarations
need to get moved to a different place in an expansion than the body
code.  Since progns and implicit progns occur a lot, the job of
writing macros would be massively complicated.  LOCALLY is just a
PROGN that allows declarations [though it's usually implemented as a
null LET, since LET has to do declaration processing anyway].

Hope that helps.


 
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.
David McClain  
View profile  
 More options Oct 22 2001, 10:15 pm
Newsgroups: comp.lang.lisp
From: "David McClain" <bar...@qwest.net>
Date: Mon, 22 Oct 2001 19:17:29 -0700
Local: Mon, Oct 22 2001 10:17 pm
Subject: Re: Declare and Progn
Yes, very helpful indeed from all of the respondents. I was completely
unaware of LOCALLY and you have all taught me something new. For that I am
quite grateful to you all!

Cheers,

- DM


 
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.
End of messages
« Back to Discussions « Newer topic     Older topic »